Mikroelektronika MIKROE-742 데이터 시트
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
Time_epochToDate
Time_dateDiff
502
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure Time_epochToDate(e: longint; var ts : 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
var ts2 : TimeStruct;
epoch : longint;
...
//what date is epoch 1234567890 ?
epoch := 1234567890 ;
//what date is epoch 1234567890 ?
epoch := 1234567890 ;
Time_epochToDate(epoch,ts2);
Prototype
function Time_dateDiff(t1 : ^TimeStruct; t2 : ^TimeStruct) :
longint ;
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
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
var ts1, ts2 : TimeStruct;
diff : longint;
...
//how many seconds between these two dates contained in ts1 and
//how many seconds between these two dates contained in ts1 and
ts2 buffers?
diff := Time_dateDiff(ts1, ts2);