#include <sys/types.h>
Go to the source code of this file.
Data Structures | |
struct | tm |
Broken down time information. More... | |
Defines | |
#define | _ABLE_CLIB_TIME_H 1 |
#define | CLOCKS_PER_SEC 1000000l |
#define | difftime(t1, t0) (double)(t1 - t0) |
Typedefs | |
typedef unsigned long | clock_t |
Functions | |
clock_t | clock (void) |
char * | asctime (const struct tm *tm) |
char * | asctime_r (const struct tm *tm, char *buf) |
char * | ctime (const time_t *timep) |
char * | ctime_r (const time_t *timep, char *buf) |
struct tm * | gmtime (const time_t *timep) |
struct tm * | gmtime_r (const time_t *timep, struct tm *result) |
struct tm * | localtime (const time_t *timep) |
struct tm * | localtime_r (const time_t *timep, struct tm *result) |
time_t | mktime (struct tm *tm) |
Convert contents of a tm struct to a time_t. | |
size_t | strftime (char *s, size_t max, const char *format, const struct tm *tm) |
Pretty print time and date from a tm struct. | |
time_t | time (time_t *t) |
Returns the seconds since the Epoch (00:00:00 1/1/1970). |
#define _ABLE_CLIB_TIME_H 1 |
#define CLOCKS_PER_SEC 1000000l |
#define difftime | ( | t1, | |||
t0 | ) | (double)(t1 - t0) |
typedef unsigned long clock_t |
char* asctime | ( | const struct tm * | tm | ) |
char* asctime_r | ( | const struct tm * | tm, | |
char * | buf | |||
) |
clock_t clock | ( | void | ) |
char* ctime | ( | const time_t * | timep | ) |
char* ctime_r | ( | const time_t * | timep, | |
char * | buf | |||
) |
Convert contents of a tm struct to a time_t.
Standard conversion from a tm struct to a number of seconds from the UNIX epoch (1970). The tm struct has years specified since an epoch of 1900, time_t has an epoch of 1970 and the Gregorian calender is based on an epoch of 1. To account for all the various leap days and reconcile these three epoch this routine converts the date to a number of days since Gregorian epoch and then subtracts from that to get the number of days since the UNIX epoch.
tm | The broken down time to convert. |
Pretty print time and date from a tm struct.
Produces a string representing a given time and date. The output string is controlled by a format specifier which consists of verbatim text which is simply copied out and % signs which introduce a part of the date or time.
The format string syntax is somewhat complicated and is generally identical to the POSIX define function of the same name. A limited number of format specifiers are not correct in this implementation.
s | The string to place output in. | |
max | The maximum length of the string s. | |
format | The format specifier. | |
tm | The structure containing the time to convert. |
Returns the seconds since the Epoch (00:00:00 1/1/1970).
t | If not NULL the return value is also stored here. |