[or-cvs] Add function to format local time in ISO format
Nick Mathewson
nickm at seul.org
Mon Nov 22 21:38:46 UTC 2004
Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv15781/src/common
Modified Files:
util.c util.h
Log Message:
Add function to format local time in ISO format
Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- util.c 16 Nov 2004 00:08:56 -0000 1.181
+++ util.c 22 Nov 2004 21:38:44 -0000 1.182
@@ -617,6 +617,10 @@
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));
}
Index: util.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- util.h 9 Nov 2004 18:22:16 -0000 1.118
+++ util.h 22 Nov 2004 21:38:44 -0000 1.119
@@ -79,6 +79,7 @@
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);
More information about the tor-commits
mailing list