File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
lib/Runtime/PlatformAgnostic/Platform/Linux Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ namespace DateTime
139139 struct tm time_tm = {0 };
140140 bool leap_added;
141141 YMD_TO_TM (ymd, &time_tm, &leap_added);
142- timelocal (&time_tm); // get zone name for the given date
142+ mktime (&time_tm); // get zone name for the given date
143143 CopyTimeZoneName (data.standardName , &data.standardNameLength , time_tm.tm_zone );
144144 *nameLength = data.standardNameLength ;
145145 return data.standardName ;
@@ -160,8 +160,7 @@ namespace DateTime
160160 // tm doesn't have milliseconds
161161 int milliseconds = local->time % 1000 ;
162162
163- tzset ();
164- time_t utime = timelocal (&local_tm);
163+ time_t utime = mktime (&local_tm);
165164 if (local_tm.tm_isdst )
166165 {
167166 utime -= 3600 ;
@@ -188,8 +187,8 @@ namespace DateTime
188187 // tm doesn't have milliseconds
189188 int milliseconds = utc->time % 1000 ;
190189
191- tzset ( );
192- time_t ltime = timegm (& utc_tm);
190+ time_t ltime = mktime (&utc_tm );
191+ ltime += -( utc_tm. tm_isdst * 3600 ) + (utc_tm. tm_gmtoff );
193192
194193 struct tm local_tm = {0 };
195194 localtime_r (<ime, &local_tm);
You can’t perform that action at this time.
0 commit comments