MicrOS
time.h File Reference
#include <stdint.h>
#include "micros.h"

Go to the source code of this file.

Classes

struct  tm
 Time structure. More...
 

Macros

#define CLOCKS_PER_SEC   1000
 Clock ticks per second. More...
 

Typedefs

typedef uint32_t clock_t
 Clock type. More...
 
typedef uint64_t time_t
 Time type. More...
 

Functions

clock_t clock ()
 Clock program. More...
 
double difftime (time_t end, time_t beginning)
 Return difference between two times. More...
 
time_t mktime (tm *timeptr)
 Convert tm structure to time_t. More...
 
time_t time (time_t *timer)
 Get current time. More...
 
tmgmtime (const time_t *timer)
 Convert time_t to tm as UTC time. More...
 
uint32_t __time_get_day_of_year (uint32_t day, uint32_t month, uint32_t year)
 Calculates time of the year. More...
 
uint32_t __time_get_day_of_week (uint32_t day, uint32_t month, uint32_t year)
 Calculates time of the week. More...
 

Variables

tm converted_time
 Internal variable used during time conversions. More...
 

Macro Definition Documentation

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   1000

Clock ticks per second.

Typedef Documentation

◆ clock_t

typedef uint32_t clock_t

Clock type.

◆ time_t

typedef uint64_t time_t

Time type.

Function Documentation

◆ __time_get_day_of_week()

uint32_t __time_get_day_of_week ( uint32_t  day,
uint32_t  month,
uint32_t  year 
)

Calculates time of the week.

Calculates time of the week based on the passed date.

Parameters
dayDay in the date to be calculated.
monthMonth in the date to be calculated.
yearYear in the date to be calculated.
Returns
Day of the week.

◆ __time_get_day_of_year()

uint32_t __time_get_day_of_year ( uint32_t  day,
uint32_t  month,
uint32_t  year 
)

Calculates time of the year.

Calculates time of the year based on the passed date.

Parameters
dayDay in the date to be calculated.
monthMonth in the date to be calculated.
yearYear in the date to be calculated.
Returns
Day of the year.

◆ clock()

clock_t clock ( )

Clock program.

Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.

Returns
Destination is returned.

◆ difftime()

double difftime ( time_t  end,
time_t  beginning 
)

Return difference between two times.

Calculates the difference in seconds between beginning and end.

Parameters
endHigher bound of the time interval whose length is calculated.
beginningLower bound of the time interval whose length is calculated. If this describes a time point later than end, the result is negative.
Returns
The result of (end-beginning) in seconds as a floating-point value of type double.

◆ gmtime()

tm* gmtime ( const time_t timer)

Convert time_t to tm as UTC time.

Uses the value pointed by timer to fill a tm structure with the values that represent the corresponding time, expressed as a UTC time (i.e., the time at the GMT timezone).

Parameters
timerPointer to an object of type time_t that contains a time value.
Returns
A pointer to a tm structure with its members filled with the values that correspond to the UTC time representation of timer.

◆ mktime()

time_t mktime ( tm timeptr)

Convert tm structure to time_t.

Returns the value of type time_t that represents the local time described by the tm structure pointed by timeptr (which may be modified).

Parameters
timeptrPointer to a tm structure that contains a calendar time broken down into its components (see struct tm).
Returns
A time_t value corresponding to the calendar time passed as argument. If the calendar time cannot be represented, a value of -1 is returned.

◆ time()

time_t time ( time_t timer)

Get current time.

Get the current calendar time as a value of type time_t.

Parameters
timerPointer to an object of type time_t, where the time value is stored.
Returns
The current calendar time as a time_t object.

Variable Documentation

◆ converted_time

tm converted_time

Internal variable used during time conversions.