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
15 changes: 10 additions & 5 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,11 @@ addToLibrary({
return ret;
},

_tzset_js__deps: ['$stringToUTF8'],
_tzset_js__deps: ['$stringToUTF8',
#if ASSERTIONS
'$lengthBytesUTF8',
#endif
],
_tzset_js__internal: true,
_tzset_js: (timezone, daylight, std_name, dst_name) => {
// TODO: Use (malleable) environment variables instead of system settings.
Expand All @@ -645,12 +649,13 @@ addToLibrary({

{{{ makeSetValue('daylight', '0', 'Number(winterOffset != summerOffset)', 'i32') }}};

function extractZone(date) {
var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/);
return match ? match[1] : "GMT";
};
var extractZone = (date) => date.toLocaleTimeString(undefined, {timeZoneName:'short'}).split(' ')[2];
var winterName = extractZone(winter);
var summerName = extractZone(summer);
#if ASSERTIONS
assert(lengthBytesUTF8(winterName) <= {{{ cDefs.TZNAME_MAX }}}, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
assert(lengthBytesUTF8(summerName) <= {{{ cDefs.TZNAME_MAX }}}, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
#endif
if (summerOffset < winterOffset) {
// Northern hemisphere
stringToUTF8(winterName, std_name, {{{ cDefs.TZNAME_MAX + 1 }}});
Expand Down
2 changes: 1 addition & 1 deletion test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_all_tests(modules):


def get_crossplatform_tests(modules):
suites = ['core2', 'other'] # We don't need all versions of every test
suites = ['core0', 'other'] # We don't need all versions of every test
crossplatform_tests = []
# Walk over the test suites and find the test functions with the
# is_crossplatform_test attribute applied by @crossplatform decorator
Expand Down
1 change: 1 addition & 0 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,7 @@ def test_strptime_reentrant(self):
self.set_setting('EXIT_RUNTIME')
self.do_core_test('test_strptime_reentrant.c')

@crossplatform
def test_strftime(self):
self.do_core_test('test_strftime.c')

Expand Down