Tizen RT Libs&Environment  v1.1 D4

Provides APIs for Time. More...

Collaboration diagram for TIME:

Files

file  time.h
 

Data Structures

struct  timespec
 structure represents an elapsed time More...
 
struct  timeval
 structure represents an elapsed time More...
 
struct  tm
 Structure containing a calendar date and time. More...
 
struct  itimerspec
 Struct itimerspec is used to define settings for an interval timer. More...
 

Macros

#define EXTERN   extern
 

Functions

int clock_settime (clockid_t clockid, FAR const struct timespec *tp)
 clock and timer functions More...
 
int clock_gettime (clockid_t clockid, FAR struct timespec *tp)
 clock and timer functions More...
 
int clock_getres (clockid_t clockid, FAR struct timespec *res)
 clock and timer functions More...
 
time_t mktime (FAR struct tm *tp)
 convert broken-down time into time since the Epoch More...
 
FAR struct tmgmtime (FAR const time_t *timer)
 convert a time value to a broken-down UTC time More...
 
FAR struct tmgmtime_r (FAR const time_t *timer, FAR struct tm *result)
 convert a time value to a broken-down UTC time More...
 
size_t strftime (char *s, size_t max, FAR const char *format, FAR const struct tm *tm)
 convert date and time to a string More...
 
time_t time (FAR time_t *tloc)
 get time More...
 
int timer_create (clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timerid)
 create a per-process timer More...
 
int timer_delete (timer_t timerid)
 delete a per-process timer More...
 
int timer_settime (timer_t timerid, int flags, FAR const struct itimerspec *value, FAR struct itimerspec *ovalue)
 per-process timers More...
 
int timer_gettime (timer_t timerid, FAR struct itimerspec *value)
 per-process timers More...
 
int nanosleep (FAR const struct timespec *rqtp, FAR struct timespec *rmtp)
 high-resolution sleep More...
 
EXTERN int gettimeofday (struct timeval *tv, FAR struct timezone *tz)
 get the date and time More...
 
EXTERN int clock_isleapyear (int year)
 Return true if the specified year is a leap year. More...
 
EXTERN int clock_daysbeforemonth (int month, bool leapyear)
 Get the number of days that occurred before the beginning of the month. More...
 
EXTERN time_t clock_calendar2utc (int year, int month, int day)
 Conversion Calendar/UTC. More...
 
#define CLK_TCK   (100)
 
#define localtime(c)   gmtime(c)
 POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/) More...
 
#define localtime_r(c, r)   gmtime_r(c, r)
 POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/) More...
 
#define CLOCKS_PER_SEC   (100)
 
#define CLOCK_REALTIME   0
 
#define TIMER_ABSTIME   1
 
typedef uint32_t time_t
 
typedef uint8_t clockid_t
 
typedef FAR void * timer_t
 

Detailed Description

Provides APIs for Time.

Macro Definition Documentation

◆ CLK_TCK

#define CLK_TCK   (100)

Definition at line 94 of file time.h.

◆ CLOCK_REALTIME

#define CLOCK_REALTIME   0

Definition at line 109 of file time.h.

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   (100)

Definition at line 95 of file time.h.

◆ EXTERN

#define EXTERN   extern

Definition at line 86 of file time.h.

◆ localtime

#define localtime (   c)    gmtime(c)

POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 132 of file time.h.

◆ localtime_r

#define localtime_r (   c,
 
)    gmtime_r(c, r)

POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 138 of file time.h.

◆ TIMER_ABSTIME

#define TIMER_ABSTIME   1

Definition at line 122 of file time.h.

Typedef Documentation

◆ clockid_t

typedef uint8_t clockid_t

Definition at line 146 of file time.h.

◆ time_t

typedef uint32_t time_t

Definition at line 145 of file time.h.

◆ timer_t

typedef FAR void* timer_t

Definition at line 147 of file time.h.

Function Documentation

◆ clock_calendar2utc()

EXTERN time_t clock_calendar2utc ( int  year,
int  month,
int  day 
)

Conversion Calendar/UTC.

#include <tinyara/time.h>
based on algorithms from p. 604 of Seidelman, P. K. 1992. Explanatory Supplement to the Astronomical Almanac. University Science Books, Mill Valley.

Parameters
[in]yearyear to change
[in]monthmonth to change
[in]dayday to change
Returns
the specific time
Since
Tizen RT v1.0

◆ clock_daysbeforemonth()

EXTERN int clock_daysbeforemonth ( int  month,
bool  leapyear 
)

Get the number of days that occurred before the beginning of the month.

#include <tinyara/time.h>

Parameters
[in]monththe beginning of the month
[in]leapyearleap year
Returns
the number of days
Since
Tizen RT v1.0

◆ clock_getres()

int clock_getres ( clockid_t  clockid,
FAR struct timespec res 
)

clock and timer functions

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ clock_gettime()

int clock_gettime ( clockid_t  clockid,
FAR struct timespec tp 
)

clock and timer functions

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ clock_isleapyear()

EXTERN int clock_isleapyear ( int  year)

Return true if the specified year is a leap year.

#include <tinyara/time.h>

Parameters
[in]yearyear to check whether a leap year or not
Returns
if leap year, TRUE or FALSE
Since
Tizen RT v1.0

◆ clock_settime()

int clock_settime ( clockid_t  clockid,
FAR const struct timespec tp 
)

clock and timer functions

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ gettimeofday()

EXTERN int gettimeofday ( struct timeval tv,
FAR struct timezone tz 
)

get the date and time

#include <sys/time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ gmtime()

FAR struct tm* gmtime ( FAR const time_t timer)

convert a time value to a broken-down UTC time

#include <time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ gmtime_r()

FAR struct tm* gmtime_r ( FAR const time_t timer,
FAR struct tm result 
)

convert a time value to a broken-down UTC time

#include <time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ mktime()

time_t mktime ( FAR struct tm tp)

convert broken-down time into time since the Epoch

#include <time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ nanosleep()

int nanosleep ( FAR const struct timespec rqtp,
FAR struct timespec rmtp 
)

high-resolution sleep

#include <time.h>
SYSTEM CALL API

Parameters
[in]rqtpThe amount of time to be suspended from execution.
[in]rmtpIf the rmtp argument is non-NULL, the timespec structure referenced by it is updated to contain the amount of time remaining in the interval (the requested time minus the time actually slept)
Returns
On success, remaining time is returned. On failure, ERROR is returned.
Since
Tizen RT v1.0

◆ strftime()

size_t strftime ( char *  s,
size_t  max,
FAR const char *  format,
FAR const struct tm tm 
)

convert date and time to a string

#include <time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ time()

time_t time ( FAR time_t tloc)

get time

#include <time.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ timer_create()

int timer_create ( clockid_t  clockid,
FAR struct sigevent evp,
FAR timer_t timerid 
)

create a per-process timer

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ timer_delete()

int timer_delete ( timer_t  timerid)

delete a per-process timer

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ timer_gettime()

int timer_gettime ( timer_t  timerid,
FAR struct itimerspec value 
)

per-process timers

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ timer_settime()

int timer_settime ( timer_t  timerid,
int  flags,
FAR const struct itimerspec value,
FAR struct itimerspec ovalue 
)

per-process timers

#include <time.h>
SYSTEM CALL API
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0