diff --git a/src/library.js b/src/library.js index 56c6ab4fafc72..b6c73d73c2111 100644 --- a/src/library.js +++ b/src/library.js @@ -687,7 +687,6 @@ addToLibrary({ stringToUTF8(summerName, std_name, {{{ cDefs.TZNAME_MAX + 1 }}}); } }, -#endif $MONTH_DAYS_REGULAR: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], $MONTH_DAYS_LEAP: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], @@ -1004,6 +1003,7 @@ addToLibrary({ strptime_l: (buf, format, tm, locale) => { return _strptime(buf, format, tm); // no locale support yet }, +#endif // ========================================================================== // setjmp.h diff --git a/test/core/test_strptime_reentrant.c b/test/core/test_strptime_reentrant.c index 2318be4c5050a..ffe87f661e8ed 100644 --- a/test/core/test_strptime_reentrant.c +++ b/test/core/test_strptime_reentrant.c @@ -13,7 +13,7 @@ #include #include -#if __GLIBC__ || __EMSCRIPTEN__ +#if defined(__GLIBC__) || (defined(__EMSCRIPTEN__) && !defined(STANDALONE)) // Not all implementations support this (for example, upstream musl) #define HAVE_WDAY #endif diff --git a/test/core/test_strptime_tm.c b/test/core/test_strptime_tm.c index 7cc4e49d0a453..f0d4377c0cb4c 100644 --- a/test/core/test_strptime_tm.c +++ b/test/core/test_strptime_tm.c @@ -15,7 +15,7 @@ #include #include -#if __GLIBC__ || __EMSCRIPTEN__ +#if defined(__GLIBC__) || (defined(__EMSCRIPTEN__) && !defined(STANDALONE)) // Not all implementations support these (for example, upstream musl) #define HAVE_WDAY #define HAVE_TIMEZONE @@ -88,15 +88,12 @@ int main() { #ifdef HAVE_TIMEZONE // check timezone offsets STRPTIME("2020-05-01T00:00+0100","%Y-%m-%dT%H:%M%z",&tm); - printf("tm_gmtoff: %ld\n",tm.tm_gmtoff); assert(tm.tm_gmtoff == 3600); STRPTIME("2020-05-01T00:00Z","%Y-%m-%dT%H:%M%z",&tm); - printf("tm_gmtoff: %ld\n",tm.tm_gmtoff); assert(tm.tm_gmtoff == 0); STRPTIME("2020-05-01T00:00-02:30","%Y-%m-%dT%H:%M%z",&tm); - printf("tm_gmtoff: %ld\n",tm.tm_gmtoff); assert(tm.tm_gmtoff == -9000); #endif diff --git a/test/core/test_strptime_tm.out b/test/core/test_strptime_tm.out index 6457f12d54de1..8272561172274 100644 --- a/test/core/test_strptime_tm.out +++ b/test/core/test_strptime_tm.out @@ -21,9 +21,6 @@ december: 11 2345,3,31,12,34,56 2003,1,2,12,34,56 2003,1,2,12,34,56 -tm_gmtoff: 3600 -tm_gmtoff: 0 -tm_gmtoff: -9000 12,34,56 12,34,56 12,34,56 diff --git a/test/test_core.py b/test/test_core.py index e3bfe8cb8e087..efdd7df67c15e 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -2681,13 +2681,19 @@ def test_time_c(self): def test_gmtime(self): self.do_core_test('test_gmtime.c') + @also_with_standalone_wasm() def test_strptime_tm(self): + if self.get_setting('STANDALONE_WASM'): + self.emcc_args += ['-DSTANDALONE'] self.do_core_test('test_strptime_tm.c') def test_strptime_days(self): self.do_core_test('test_strptime_days.c') + @also_with_standalone_wasm() def test_strptime_reentrant(self): + if self.get_setting('STANDALONE_WASM'): + self.emcc_args += ['-DSTANDALONE'] self.do_core_test('test_strptime_reentrant.c') @crossplatform diff --git a/tools/system_libs.py b/tools/system_libs.py index c3e5e79ee36f8..2fe23413bed92 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -2204,6 +2204,7 @@ def get_files(self): 'localtime_r.c', 'gmtime_r.c', 'mktime.c', + 'strptime.c', 'timegm.c', 'time.c']) # It is more efficient to use JS for __assert_fail, as it avoids always