From 74ab661ca1035f0a724cfaa8a9f3a6fe66dfd43e Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Sun, 3 Jan 2016 16:36:40 +0100 Subject: [PATCH] Add timezone to generated bind slave zone files --- pdns/misc.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pdns/misc.cc b/pdns/misc.cc index 4417658dd6..5ef1138b44 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -174,10 +174,13 @@ int writen2WithTimeout(int fd, const void * buffer, size_t len, int timeout) string nowTime() { - time_t now=time(0); - string t=ctime(&now); - boost::trim_right(t); - return t; + time_t now = time(nullptr); + struct tm* tm = localtime(&now); + char buffer[30]; + // YYYY-mm-dd HH:MM:SS TZOFF + strftime(buffer, sizeof(buffer), "%F %T %z", tm); + buffer[sizeof(buffer)-1] = '\0'; + return buffer; } uint16_t getShort(const unsigned char *p) -- 2.47.2