summary refs log tree commit diff
path: root/src/fmt_ptime.c
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2003-09-23 08:01:17 +0000
committerGerrit Pape <pape@smarden.org>2003-09-23 08:01:17 +0000
commitddd4597ac5f4fcf8d6431a225921aa7c7e5890d7 (patch)
tree3f1e2abc74406eb526d46e115465c10bf3abe662 /src/fmt_ptime.c
parentdd7b6a8808c197c986909335cf1c66e20048f9b4 (diff)
downloadrunit-ddd4597ac5f4fcf8d6431a225921aa7c7e5890d7.tar.gz
runit-ddd4597ac5f4fcf8d6431a225921aa7c7e5890d7.tar.xz
runit-ddd4597ac5f4fcf8d6431a225921aa7c7e5890d7.zip
* fmt_ptime.c: calculate UTC localtime correctly.
  * runsv.c: support ./supervise as symbolic link, on dangling symlink create
    link target.
Diffstat (limited to 'src/fmt_ptime.c')
-rw-r--r--src/fmt_ptime.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fmt_ptime.c b/src/fmt_ptime.c
index 86fdcc2..b78f9d7 100644
--- a/src/fmt_ptime.c
+++ b/src/fmt_ptime.c
@@ -3,8 +3,11 @@
 
 unsigned int fmt_ptime(char *s, struct taia *ta) {
   struct tm *t;
+  unsigned long u;
 
-  if (! (t =localtime((time_t*)&ta->sec.x))) return(0);
+  if (ta->sec.x < 4611686018427387914ULL) return(0); /* impossible? */
+  u =ta->sec.x -4611686018427387914ULL;
+  if (! (t =localtime((time_t*)&u))) return(0);
   fmt_ulong(s, 1900 +t->tm_year);
   s[4] ='-'; fmt_uint0(&s[5], t->tm_mon +1, 2);
   s[7] ='-'; fmt_uint0(&s[8], t->tm_mday, 2);