Thread: [Solved] Get remain time problem
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-22-2021 , 12:23   Re: Get remain time problem
Reply With Quote #11

This seems to work consistently.

PHP Code:
public Test() 
{
    const 
iActionTime 22;
    
    new 
iHours iMinutes iSeconds szTime] , iUnixTSNow iUnixTSAction;
    
    
iUnixTSNow parse_timeszTime "%H:%M:%S" );
    
    
formatexszTime charsmaxszTime ) , "%d:%d:%d" iActionTime );
    
iUnixTSAction parse_timeszTime "%H:%M:%S" );
    
    
iUnixTSAction -= iUnixTSNow;
    
iHours = ( iUnixTSAction 3600 ) % 24;
    
iMinutes = ( iUnixTSAction 60 ) % 60;
    
iSeconds = ( iUnixTSAction 60 );
    
    
server_print"%d hour%s, %d minute%s, %d second%s" iHours iHours == "" "s" iMinutes iMinutes == "" "s"iSeconds iSeconds == "" "s" );

__________________

Last edited by Bugsy; 08-26-2021 at 23:33.
Bugsy is offline