User manual
681
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
Time Library
The Time Library contains functions and type denitions for time calculations in the UNIX time format which counts the
number of seconds since the “epoch”. This is very convenient for programs that work with time intervals: the difference
between two UNIX time values is a real-time difference measured in seconds.
What is the epoch?
Originally it was dened as the beginning of 1970 GMT. (January 1, 1970 Julian day) GMT, Greenwich Mean Time, is
a traditional term for the time zone in England.
The TimeStruct type is a structure type suitable for time and date storage.
Library Routines
- Time_dateToEpoch
- Time_epochToDate
- Time_dateDiff
Time_dateToEpoch
Prototype
function Time_dateToEpoch(var ts : TimeStruct) : longint;
Description This function returns the UNIX time : number of seconds since January 1, 1970 0h00mn00s.
Parameters - ts: time and date value for calculating UNIX time.
Returns Number of seconds since January 1, 1970 0h00mn00s.
Requires Nothing.
Example
var ts1 : TimeStruct;
Epoch : longint;
...
// what is the epoch of the date in ts ?
epoch := Time_dateToEpoch(@ts1) ;
Notes None.