View Single Post
glhf3000
Member
Join Date: Aug 2010
Location: middle-universe
Old 02-08-2024 , 09:30   Re: [INC] Unix Time by Bugsy - Ported to SourceMod
Reply With Quote #4

Since this inc has ~1000 downloads, here are my 2 cents:

1. TZ offset calc in GetTimeZone() is wrong:

PHP Code:
// FormatTime( szTime, sizeof( szTime ), "%m~%d~%y~%H~%M~%S", GetTime( ) ); // 24 -> 2024
FormatTimeszTimesizeofszTime ), "%m~%d~%Y~%H~%M~%S"GetTime( ) );
    
// char szTimeParts[ 6 ][ 4 ]; // https://github.com/alliedmodders/sourcepawn/blob/96ce3259003c8fe77cf9f1a0f84bbb3167b81b5d/vm/plugin-context.cpp#L346
char szTimeParts][ ]; 
&&

2. imagine local_unix->local_datetime->(change hour?)->local_unix, in TimeToUnix( using UT_TIMEZONE_SERVER ) there should be -, not + (double check my logic, timezones = minefield)
PHP Code:
// return ( iTimeStamp + g_iTimeZoneOffset[ iTimeZone ] );
return ( iTimeStamp g_iTimeZoneOffsetiTimeZone ] ); 

Fixed inc:
Attached Files
File Type: inc unixtime_sourcemod.inc (6.3 KB, 61 views)

Last edited by glhf3000; 02-08-2024 at 11:19.
glhf3000 is offline