All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups

Detailed Description

Standard system time functions.

This module contains standard time functions and formatters for printing. Note that Pebble only supports local time and does not support timezones.

Most of these functions are part of the C standard library which is documented at https://sourceware.org/newlib/libc.html#Timefns

Function Documentation

struct tm * localtime ( const time_t clock)

convert the time value pointed at by clock to a struct tm which contains the time adjusted for the local timezone

Parameters
clockA pointer to an object of type time_t that contains a time value
Returns
A pointer to a struct tm containing the broken out time value adjusted for the local timezone
time_t mktime ( struct tm *  timeptr)

Convert the tm structure to a time_t value representing local time.

Parameters
timeptrThe struct tm pointer for the time to be converted
Returns
A value representing local time
size_t strftime ( char *  s,
size_t  max,
const char *  fmt,
const struct tm *  tm 
)

Format the time value at tm according to fmt and place the result in a buffer s of size max.

Parameters
sA preallocation char array of size max
maxthe size of the array s
fmta formatting string
tmA pointer to a struct tm containing a broken out time value
Returns
The number of bytes placed in the array s, not including the null byte. 0 if the value does not fit.
time_t time ( time_t tloc)

Obtain the number of seconds since the epoch.

Note that the epoch is adjusted for Timezones and Daylight Savings.

Parameters
tlocOptionally points to an address of a time_t variable to store the time in. If you only want to use the return value, you may pass NULL into tloc instead
Returns
The number of seconds since the epoch
uint16_t time_ms ( time_t tloc,
uint16_t out_ms 
)

Obtain the number of seconds and milliseconds part since the epoch.

This is a non-standard C function provided for convenience.

Parameters
tlocOptionally points to an address of a time_t variable to store the time in. You may pass NULL into tloc if you don't need a time_t variable to be set with the seconds since the epoch
out_msOptionally points to an address of a uint16_t variable to store the number of milliseconds since the last second in. If you only want to use the return value, you may pass NULL into out_ms instead
Returns
The number of milliseconds since the last second

Typedef Documentation

time in seconds