瀏覽代碼

strftime: fix underlying format string in %z format

the expression (tm->__tm_gmtoff)/3600 has type long. use %+.2ld instead.
Daniel Sabogal 6 年之前
父節點
當前提交
da5851e9f4
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/time/strftime.c

+ 1 - 1
src/time/strftime.c

@@ -181,7 +181,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
 			*l = 0;
 			return "";
 		}
-		*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
+		*l = snprintf(*s, sizeof *s, "%+.2ld%.2d",
 			(tm->__tm_gmtoff)/3600,
 			abs(tm->__tm_gmtoff%3600)/60);
 		return *s;