commit 9e3e1b8bfb7739d3add782a9f2fe7242ec9a36ae Author: Neel Chauhan neel@neelc.org Date: Mon Apr 16 20:14:49 2018 -0400
Add format_local_iso_time_nospace() --- src/common/util.c | 9 +++++++++ src/common/util.h | 1 + 2 files changed, 10 insertions(+)
diff --git a/src/common/util.c b/src/common/util.c index 041e7aee3..b7516b8b6 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1821,6 +1821,15 @@ format_iso_time(char *buf, time_t t) strftime(buf, ISO_TIME_LEN+1, "%Y-%m-%d %H:%M:%S", tor_gmtime_r(&t, &tm)); }
+/** As format_local_iso_time, but use the yyyy-mm-ddThh:mm:ss format to avoid + * embedding an internal space. */ +void +format_local_iso_time_nospace(char *buf, time_t t) +{ + format_local_iso_time(buf, t); + buf[10] = 'T'; +} + /** As format_iso_time, but use the yyyy-mm-ddThh:mm:ss format to avoid * embedding an internal space. */ void diff --git a/src/common/util.h b/src/common/util.h index ae27e5f01..5708b7fd8 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -269,6 +269,7 @@ int parse_rfc1123_time(const char *buf, time_t *t); #define ISO_TIME_USEC_LEN (ISO_TIME_LEN+7) void format_local_iso_time(char *buf, time_t t); void format_iso_time(char *buf, time_t t); +void format_local_iso_time_nospace(char *buf, time_t t); void format_iso_time_nospace(char *buf, time_t t); void format_iso_time_nospace_usec(char *buf, const struct timeval *tv); int parse_iso_time_(const char *cp, time_t *t, int strict, int nospace);
tor-commits@lists.torproject.org