Time handling APIs.
More...
Go to the source code of this file.
|
long | qtime_current_milli (void) |
| Returns the current time in milliseconds.
|
|
char * | qtime_localtime_strf (char *buf, int size, time_t utctime, const char *format) |
| Get custom formmatted local time string.
|
|
char * | qtime_localtime_str (time_t utctime) |
| Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
|
|
const char * | qtime_localtime_staticstr (time_t utctime) |
| Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
|
|
char * | qtime_gmt_strf (char *buf, int size, time_t utctime, const char *format) |
| Get custom formmatted GMT time string.
|
|
char * | qtime_gmt_str (time_t utctime) |
| Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
|
|
const char * | qtime_gmt_staticstr (time_t utctime) |
| Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
|
|
time_t | qtime_parse_gmtstr (const char *gmtstr) |
| This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT', 'Mon, 05 May 2008 03:50:39 +0900' and returns as universal time.
|
|
Time handling APIs.
Definition in file qtime.c.
◆ __USE_XOPEN
◆ _XOPEN_SOURCE
◆ _BSD_SOURCE
◆ qtime_current_milli()
long qtime_current_milli |
( |
void |
| ) |
|
Returns the current time in milliseconds.
- Returns
- current time in milliseconds.
Definition at line 49 of file qtime.c.
◆ qtime_localtime_strf()
char * qtime_localtime_strf |
( |
char * |
buf, |
|
|
int |
size, |
|
|
time_t |
utctime, |
|
|
const char * |
format |
|
) |
| |
Get custom formmatted local time string.
- Parameters
-
buf | save buffer |
size | buffer size |
utctime | 0 for current time, universal time for specific time |
format | format for strftime() |
- Returns
- string pointer of buf
free(timestr);
free(timestr);
char * qtime_localtime_strf(char *buf, int size, time_t utctime, const char *format)
Get custom formmatted local time string.
Definition at line 73 of file qtime.c.
◆ qtime_localtime_str()
char * qtime_localtime_str |
( |
time_t |
utctime | ) |
|
Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
- Parameters
-
utctime | 0 for current time, universal time for specific time |
- Returns
- mallocked string pointer of time string
char *timestr;
free(timestr);
free(timestr);
free(timestr);
char * qtime_localtime_str(time_t utctime)
Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
Definition at line 103 of file qtime.c.
◆ qtime_localtime_staticstr()
const char * qtime_localtime_staticstr |
( |
time_t |
utctime | ) |
|
Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
- Parameters
-
utctime | 0 for current time, universal time for specific time |
- Returns
- internal static string pointer of time string
const char * qtime_localtime_staticstr(time_t utctime)
Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.
Definition at line 125 of file qtime.c.
◆ qtime_gmt_strf()
char * qtime_gmt_strf |
( |
char * |
buf, |
|
|
int |
size, |
|
|
time_t |
utctime, |
|
|
const char * |
format |
|
) |
| |
Get custom formmatted GMT time string.
- Parameters
-
buf | save buffer |
size | buffer size |
utctime | 0 for current time, universal time for specific time |
format | format for strftime() |
- Returns
- string pointer of buf
char timestr[8+1];
char * qtime_gmt_strf(char *buf, int size, time_t utctime, const char *format)
Get custom formmatted GMT time string.
Definition at line 148 of file qtime.c.
◆ qtime_gmt_str()
char * qtime_gmt_str |
( |
time_t |
utctime | ) |
|
Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
- Parameters
-
utctime | 0 for current time, universal time for specific time |
- Returns
- malloced string pointer which points GMT time string.
char *timestr;
free(timestr);
free(timestr);
free(timestr);
char * qtime_gmt_str(time_t utctime)
Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
Definition at line 174 of file qtime.c.
◆ qtime_gmt_staticstr()
const char * qtime_gmt_staticstr |
( |
time_t |
utctime | ) |
|
Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
- Parameters
-
utctime | 0 for current time, universal time for specific time |
- Returns
- internal static string pointer which points GMT time string.
const char * qtime_gmt_staticstr(time_t utctime)
Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.
Definition at line 197 of file qtime.c.
◆ qtime_parse_gmtstr()
time_t qtime_parse_gmtstr |
( |
const char * |
gmtstr | ) |
|
This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT', 'Mon, 05 May 2008 03:50:39 +0900' and returns as universal time.
- Parameters
-
gmtstr | GMT/Timezone(+/-) formatted time string |
- Returns
- universal time(UTC). in case of conversion error, returns -1.
time_t t = time(NULL);
printf("%d\n", t);
printf("%s\n", s);
free(s);
time_t qtime_parse_gmtstr(const char *gmtstr)
This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT',...
Definition at line 223 of file qtime.c.