remove hand-written crt1.s and Scrt1.s files for all archs
[musl] / src / time / strftime.c
index 75ebca6..e945bb7 100644 (file)
@@ -5,6 +5,7 @@
 #include <locale.h>
 #include <time.h>
 #include <limits.h>
+#include "locale_impl.h"
 #include "libc.h"
 #include "time_impl.h"
 
@@ -125,7 +126,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
                fmt = "%H:%M";
                goto recu_strftime;
        case 's':
-               val = __tm_to_secs(tm) + tm->__tm_gmtoff;
+               val = __tm_to_secs(tm) - tm->__tm_gmtoff;
                width = 1;
                goto number;
        case 'S':
@@ -177,7 +178,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
                        return "";
                }
                *l = snprintf(*s, sizeof *s, "%+.2d%.2d",
-                       (-tm->__tm_gmtoff)/3600,
+                       (tm->__tm_gmtoff)/3600,
                        abs(tm->__tm_gmtoff%3600)/60);
                return *s;
        case 'Z':
@@ -263,7 +264,7 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
 
 size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
 {
-       return __strftime_l(s, n, f, tm, 0);
+       return __strftime_l(s, n, f, tm, CURRENT_LOCALE);
 }
 
 weak_alias(__strftime_l, strftime_l);