Open Garden  0.10.1-21
Data Structures | Macros | Typedefs | Functions
time.h File Reference

standard libc time handling functions, reduced and adapted to atmega project. More...

#include "rtc.h"
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tm
 

Macros

#define LEAP_YEAR(year)   ((year%4)==0)
 

Typedefs

typedef unsigned long time_t
 

Functions

void settimeofday (const time_t seconds)
 
time_t gettimeofday (void)
 
time_t time (time_t *t)
 
struct tmgmtime (time_t *timep)
 
time_t mktime (struct tm *timeptr)
 
char * asctime (struct tm *timeptr)
 
char * ctime (time_t *timep)
 

Detailed Description

standard libc time handling functions, reduced and adapted to atmega project.

Macro Definition Documentation

◆ LEAP_YEAR

#define LEAP_YEAR (   year)    ((year%4)==0)

A leap year is ((((year%4)==0) && ((year%100)!=0)) || ((year%400)==0)) but since we have no fancy years between 1970 and 2038 we can do:

Typedef Documentation

◆ time_t

typedef unsigned long time_t

seconds since the epoch

Function Documentation

◆ asctime()

char* asctime ( struct tm timeptr)

format the time into "Sat Feb 17 17:45:23 2001\n"

◆ ctime()

char* ctime ( time_t timep)

C lib ctime

◆ gettimeofday()

time_t gettimeofday ( void  )

C lib gettimeofday

◆ gmtime()

struct tm* gmtime ( time_t timep)

convert calendar time (seconds since 1970) to broken-time.

This only works for dates between 01-01-1970 00:00:00 and 19-01-2038 03:14:07

◆ mktime()

time_t mktime ( struct tm timeptr)

convert broken time to calendar time (seconds since 1970)

◆ settimeofday()

void settimeofday ( const time_t  seconds)

C lib settimeofday

◆ time()

time_t time ( time_t t)

C lib time