Functions | |
char * | qTimeGetLocalStrf (char *buf, int size, time_t utctime, const char *format) |
Get custom formmatted local time string. | |
char * | qTimeGetLocalStr (time_t utctime) |
Get local time string formatted like ’02-Nov-2007 16:37:39 +0900′. | |
const char * | qTimeGetLocalStaticStr (time_t utctime) |
Get local time string formatted like ’02-Nov-2007 16:37:39 +0900′. | |
char * | qTimeGetGmtStrf (char *buf, int size, time_t utctime, const char *format) |
Get custom formmatted GMT time string. | |
char * | qTimeGetGmtStr (time_t utctime) |
Get GMT time string formatted like ‘Wed, 11-Nov-2007 23:19:25 GMT’. | |
const char * | qTimeGetGmtStaticStr (time_t utctime) |
Get GMT time string formatted like ‘Wed, 11-Nov-2007 23:19:25 GMT’. | |
time_t | qTimeParseGmtStr (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. |
char* qTimeGetLocalStrf | ( | char * | buf, | |
int | size, | |||
time_t | utctime, | |||
const char * | format | |||
) |
Get custom formmatted local time string.
buf | save buffer | |
size | buffer size | |
utctime | 0 for current time, universal time for specific time | |
format | format for strftime() |
char *timestr = qTimeGetLocalStrf(0, "%H:%M:%S"); // HH:MM:SS free(timestr); char *timestr = qTimeGetLocalStrf(0, "%Y%m%d%H%M%S"); // YYMMDDhhmmss free(timestr);
char* qTimeGetLocalStr | ( | time_t | utctime | ) |
Get local time string formatted like ’02-Nov-2007 16:37:39 +0900′.
utctime | 0 for current time, universal time for specific time |
char *timestr; timestr = qGetLocaltimeStr(0); // now free(timestr); timestr = qGetLocaltimeStr(time(NULL)); // same as above free(timestr); timestr = qGetLocaltimeStr(time(NULL) - 86400)); // 1 day before free(timestr);
const char* qTimeGetLocalStaticStr | ( | time_t | utctime | ) |
Get local time string formatted like ’02-Nov-2007 16:37:39 +0900′.
utctime | 0 for current time, universal time for specific time |
printf("%s", qTimeGetLocalStaticStr(0)); // now printf("%s", qTimeGetLocalStaticStr(time(NULL) + 86400)); // 1 day later
char* qTimeGetGmtStrf | ( | char * | buf, | |
int | size, | |||
time_t | utctime, | |||
const char * | format | |||
) |
Get custom formmatted GMT time string.
buf | save buffer | |
size | buffer size | |
utctime | 0 for current time, universal time for specific time | |
format | format for strftime() |
char timestr[8+1]; qTimeGetGmtStrf(buf, sizeof(buf), 0, "%H:%M:%S"); // HH:MM:SS
char* qTimeGetGmtStr | ( | time_t | utctime | ) |
Get GMT time string formatted like ‘Wed, 11-Nov-2007 23:19:25 GMT’.
utctime | 0 for current time, universal time for specific time |
char *timestr; timestr = qTimeGetGmtStr(0); // now free(timestr); timestr = qTimeGetGmtStr(time(NULL)); // same as above free(timestr); timestr = qTimeGetGmtStr(time(NULL) - 86400)); // 1 day before free(timestr);
const char* qTimeGetGmtStaticStr | ( | time_t | utctime | ) |
Get GMT time string formatted like ‘Wed, 11-Nov-2007 23:19:25 GMT’.
utctime | 0 for current time, universal time for specific time |
printf("%s", qTimeGetGmtStaticStr(0)); // now printf("%s", qTimeGetGmtStaticStr(time(NULL) + 86400)); // 1 day later
time_t qTimeParseGmtStr | ( | 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.
gmtstr | GMT/Timezone(+/-) formatted time string |
time_t t = time(NULL); char *s = qTimeGetGmtStr(t); printf("%dn", t); printf("%sn", s); printf("%dn", qTimeParseGmtStr(s)); // this must be same as t free(s);
[Home] [About] [Examples] [Changes] [Download] [SVN Repository] [Install] [Reference] |