Datasheet
Time_epochToDate
Time_dateDiff
496
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure Time_epochToDate(dim e as longint, dim byref ts as
TimeStruct)
Returns Nothing.
Description
Converts the UNIX time to time and date.
Parameters :
-
e: UNIX time (seconds since UNIX epoch)
- ts: time and date structure for storing conversion output
Requires Nothing.
Example
dim ts2 as TimeStruct
epoch as longint
...
' what date is epoch 1234567890 ?
epoch = 1234567890
Time_epochToDate(epoch,ts2)
Prototype
sub function Time_dateDiff(dim t1 as ^TimeStruct, dim t2 as
^TimeStruct) as longint
Returns Time difference in seconds as a signed long.
Description
This function compares two dates and returns time difference in seconds as a
signed long. The result is positive if t1 is before t2, null if t1 is the same as t2
and negative if t1 is after t2.
Parameters :
-
t1: time and date structure (the first comparison parameter)
- t2: time and date structure (the second comparison parameter)
Requires Nothing.
Example
dim ts1, ts2 as TimeStruct
diff as longint
...
' how many seconds between these two dates contained in ts1 and
ts2 buffers?
diff = Time_dateDiff(ts1, ts2)