minor timezone fix +/-

master
Alexey Khromov 6 months ago
parent 6ebf2fc7a3
commit ccf473515d

@ -176,15 +176,15 @@ long time_gmtoffset(void)
long tz = local.tm_yday - gmt.tm_yday; long tz = local.tm_yday - gmt.tm_yday;
if( tz > 1 ) if( tz > 1 )
tz = 24;
else if( tz < -1 )
tz = -24; tz = -24;
else if( tz < -1 )
tz = +24;
else else
tz *= 24; tz *= 24;
tz += local.tm_hour - gmt.tm_hour; tz += gmt.tm_hour - local.tm_hour;
tz *= 60; tz *= 60;
tz += local.tm_min - gmt.tm_min; tz += gmt.tm_min - local.tm_min;
return tz; return tz;
} }
@ -200,7 +200,7 @@ long time_gmtoffset(void)
*/ */
char *time_string_gmtoffset(char *buffer) char *time_string_gmtoffset(char *buffer)
{ {
long tz = time_gmtoffset(); long tz = -time_gmtoffset();
char sign = (tz > 0)?'+':'-'; char sign = (tz > 0)?'+':'-';
tz = abs(tz); tz = abs(tz);
unsigned int hour = tz/60; unsigned int hour = tz/60;

Loading…
Cancel
Save