What's new

Chaotic UTC and local time in merlin

Yeah, I spotted the tmpstr issue but missed the typo for UTC. Like I said, I don't understand their thinking for this. Maybe they simply forgot to assign UTC-9 to tmpstr.

EDIT: It looks like technically UCT is a valid synonym UTC.
For the `date` command, the three-letter string of `TZ` is not that important. It is the signed number that controls the time zone.
Code:
# TZ="ABC-9" date
Sat Jun 11 11:04:47 ABC 2022
# TZ="XYZ-9" date
Sat Jun 11 11:05:08 XYZ 2022
For consistency and readability of the source code, it should be normalized to use, for example, only 'UTC' for Coordinated Universal Time.
 
I've created a PR #818 to fix this.
C:
   if (nvram_match("time_zone", "JST")) {
       nvram_set("time_zone_x", "UTC-9");
       tmpstr="JST-9";
   }
You've got the right idea for the fix in your PR, but the incorrect syntax in this line: tmpstr="JST-9";

The correct syntax would be:
C:
sprintf (tmpstr, "%s", "JST-9");

// OR even better //

snprintf (tmpstr, sizeof(tmpstr), "%s", "JST-9");

FYI.
 
C:
   if (nvram_match("time_zone", "JST")) {
       nvram_set("time_zone_x", "UTC-9");
       tmpstr="JST-9";
   }
You've got the right idea for the fix in your PR, but the incorrect syntax in this line: tmpstr="JST-9";

The correct syntax would be:
C:
sprintf (tmpstr, "%s", "JST-9");

// OR even better //

snprintf (tmpstr, sizeof(tmpstr), "%s", "JST-9");

FYI.
Fixed. Thank you so much for your correction. Portal
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top