Datasheet

Library Example
This example demonstrates Time Library usage.
#include "timelib.h"
TimeStruct ts1, ts2 ;
long epoch ;
long diff ;
void main() {
ts1.ss = 0 ;
ts1.mn = 7 ;
ts1.hh = 17 ;
ts1.md = 23 ;
ts1.mo = 5 ;
ts1.yy = 2006 ;
/*
* What is the epoch of the date in ts ?
*/
epoch = Time_dateToEpoch(&ts1) ;
/*
* What date is epoch 1234567890 ?
*/
epoch = 1234567890 ;
Time_epochToDate(epoch, &ts2) ;
/*
* How much seconds between this two dates ?
*/
diff = Time_dateDiff(&ts1, &ts2) ;
}
576
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6