Datasheet
TIME LIBRARY
The Time Library contains functions and type definitions for time calculations in the UNIX time for-
mat 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 differ-
ence measured in seconds.
What is the epoch?
Originally it was defined 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. Type declaration is
contained in
timelib.h which can be found in the mikroC PRO for AVR Time Library Demo
example folder.
Library Routines
- Time_dateToEpoch
- Time_epochToDate
- Time_dateDiff
Time_dateToEpoch
573
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
long Time_dateToEpoch(TimeStruct *ts);
Returns Number of seconds since January 1, 1970 0h00mn00s.
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.
Requires Nothing.
Example
#include "timelib.h"
...
TimeStruct ts1;
long epoch ;
...
/*
* what is the epoch of the date in ts ?
*/
epoch = Time_dateToEpoch(&ts1) ;