Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/other/test_wcsftime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2017 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.

#include <assert.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>

int main() {
struct tm tm;
wchar_t s[1000];

// Ensure all fields of `tm` are initialized correctly
// before we start messing with them.
time_t t = 0;
gmtime_r(&t, &tm);

tm.tm_sec = 4;
tm.tm_min = 23;
tm.tm_hour = 20;
tm.tm_mday = 21;
tm.tm_mon = 1;
tm.tm_year = 74;
tm.tm_wday = 4;
tm.tm_yday = 51;
tm.tm_isdst = 0;

const wchar_t *fmt = L"%m/%d/%Y %H:%M:%S %Z";
wcsftime(s, sizeof(s), fmt, &tm);
printf("%ls -> %ls\n", fmt, s);

return 0;
}
1 change: 1 addition & 0 deletions test/other/test_wcsftime.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%m/%d/%Y %H:%M:%S %Z -> 02/21/1974 20:23:04 GMT
4 changes: 4 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -6193,6 +6193,10 @@ def test_strptime_reentrant(self):
def test_strftime(self):
self.do_other_test('test_strftime.c')

@crossplatform
def test_wcsftime(self):
self.do_other_test('test_wcsftime.c')

@crossplatform
def test_strftime_zZ(self):
if MACOS:
Expand Down
2 changes: 2 additions & 0 deletions tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,9 @@ def get_files(self):
'__tm_to_secs.c',
'__year_to_secs.c',
'__month_to_secs.c',
'wcsftime.c',
])

libc_files += files_in_path(
path='system/lib/libc/musl/src/legacy',
filenames=['getpagesize.c', 'err.c', 'euidaccess.c'])
Expand Down
Loading