Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
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 ;
Time_epochToDate(epoch,ts2);
Prototype
function Time_dateDiff(t1 : ^TimeStruct; t2 : ^TimeStruct) :
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
var ts1, ts2 : TimeStruct;
diff : longint;
...
//how many seconds between these two dates contained in ts1 and
ts2 buffers?
diff := Time_dateDiff(ts1, ts2);