FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT
Author Message
FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT

I am developing an automated phone system using Foxpro2.6/dos and windows
This program is intended to work unattended using a buffer box(Tapit).
Problem:
How can I make time calculations such as:

starting time(field)
taken from ending time (field) times rate = cost

5

333

Thu, 20 Nov 1997 03:00:00 GMT
FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT

Quote:
>I am developing an automated phone system using Foxpro2.6/dos and windows
>This program is intended to work unattended using a buffer box(Tapit).
>Problem:
>How can I make time calculations such as:
>starting time(field)
>taken from ending time (field) times rate = cost

Try looking at the SECONDS() command.

starttime = seconds()

do stuff

ElapsedTime = seconds() - starttime

Jack Linder

Fri, 21 Nov 1997 03:00:00 GMT
FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT

Quote:

>I am developing an automated phone system using Foxpro2.6/dos and windows
>This program is intended to work unattended using a buffer box(Tapit).
>Problem:
>How can I make time calculations such as:

>starting time(field)
>taken from ending time (field) times rate = cost

You could try this

*returns time in minutes

* convert StTime and EndTime to a numeric
* start and end are in seconds

start = LTRIM(LOWER(StTime))
start = VAL(SUBSTR(start,1,2))*3600 +;
VAL(SUBSTR(start,4,2))*60 +;
VAL(SUBSTR(start,7,2))

end = LTRIM(LOWER(EndTime))
end = VAL(SUBSTR(end,1,2))*3600 +;
VAL(SUBSTR(end,4,2))*60 +;
VAL(SUBSTR(end,7,2))

tot = (end-start)/60
* Rate in minutes
rate = 1.50
charge = tot * rate

Sue Jones
HyperWindows Inc.

Fri, 21 Nov 1997 03:00:00 GMT
FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT
Quote:

>  I am developing an automated phone system using Foxpro2.6/dos and windows
>  This program is intended to work unattended using a buffer box(Tapit).
>  Problem:
>  How can I make time calculations such as:
(snip)

There are a couple of answers posted, but both neglect time that span midnight.

You might want to consider that unless the app will only run when this can't happen!

Larry

Fri, 21 Nov 1997 03:00:00 GMT
FOXPRO PHONE SYSTEM/REAL TIME DEVELOPEMT

Quote:

>I am developing an automated phone system using Foxpro2.6/dos and
windows
>This program is intended to work unattended using a buffer box(Tapit).
>Problem:
>How can I make time calculations such as:

>starting time(field)
>taken from ending time (field) times rate = cost

First you need the elapsed time in seconds (or whatever unit you measure
in)

Don'te forget to account for starting and ending times spanning two or
more days.

s_date = DATE()
s_time = SECONDS()

* time passes...

e_time = SECONDS()
e_date = DATE()

secs_in_day = (24*60*60)  && seconds in a day

elapsed = (((e_date-s_date)*secs_in_day)+e_time) - s_time

you now have elapsed time in seconds.  The trickk is to make the ending
time relative to the starting time with respect to elapsed days as well
as seconds since midnight.

Anyone else feel free to jump in a correct me if I missed something...
I'm sure this has been done by sharper individuals than myself, possibly
in a more elegant manner.

Hope this helps you out...

Jeff

=========================================================================
==========
Jeff Davis
E-Mail..................................................

Snail Mail.............................................. Petra
Informatics
Suite H
Bakersfield, CA
93313
USA
Voice................................................... 805.398.2296
Fax..................................................... 805.398-2296