08-23-2003, 08:00 PM
What format your times/dates have (SYSTEMTIME, FILETIME, DATE, from GetTickCount, from Date and Time functions, etc)? And what format should have the difference?
Probably GetTickCount will be best in this case. It returns number of milliseconds since Windows start. Example:
_____________________
Now let's use SYSTEMTIME.
Here is how to get time as SYSTEMTIME:
Here is function TimeDiff that returns difference between two times as number of seconds:
Probably GetTickCount will be best in this case. It returns number of milliseconds since Windows start. Example:
_____________________
Now let's use SYSTEMTIME.
Here is how to get time as SYSTEMTIME:
Here is function TimeDiff that returns difference between two times as number of seconds:
;/
function% SYSTEMTIME*time1 SYSTEMTIME*time2
;Returns difference between two times as number of seconds.
;If time1 is more than time2, return value is positive;
;if time1 is less than time2, return value is negative.
;time1 and time2 are pointers to variables of type SYSTEMTIME.
;To get current time, use function GetLocalTime.
;EXAMPLE
;SYSTEMTIME before2seconds now
;GetLocalTime &before2seconds
;wait 2
;GetLocalTime &now
;out TimeDiff(&now &before2seconds)
type FTLONG FILETIME'ft [0]%l
FTLONG ft1 ft2
if(!SystemTimeToFileTime(time1 &ft1.ft) or !SystemTimeToFileTime(time2 &ft2.ft)) end "invalid argument"
ret (ft1.l/10000000)-(ft2.l/10000000)