]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add timezone to generated bind slave zone files 3156/head
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Sun, 3 Jan 2016 15:36:40 +0000 (16:36 +0100)
committerChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Sun, 3 Jan 2016 15:36:40 +0000 (16:36 +0100)
pdns/misc.cc

index 4417658dd6244973436db51e47f26692fa5daf36..5ef1138b44dc390153e4e9a6e2c8ce119fff9c68 100644 (file)
@@ -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)