mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Add function to format local time in ISO format
svn:r2935
This commit is contained in:
@@ -617,6 +617,10 @@ int parse_rfc1123_time(const char *buf, time_t *t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void format_local_iso_time(char *buf, time_t t) {
|
||||
strftime(buf, ISO_TIME_LEN+1, "%Y-%m-%d %H:%M:%S", localtime(&t));
|
||||
}
|
||||
|
||||
void format_iso_time(char *buf, time_t t) {
|
||||
strftime(buf, ISO_TIME_LEN+1, "%Y-%m-%d %H:%M:%S", gmtime(&t));
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ time_t tor_timegm(struct tm *tm);
|
||||
void format_rfc1123_time(char *buf, time_t t);
|
||||
int parse_rfc1123_time(const char *buf, time_t *t);
|
||||
#define ISO_TIME_LEN 19
|
||||
void format_local_iso_time(char *buf, time_t t);
|
||||
void format_iso_time(char *buf, time_t t);
|
||||
int parse_iso_time(const char *buf, time_t *t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user