viewing paste time_ENG | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
function        script  Time2Str2       {
        set .@Time_Left, getarg(0);
       
        set .@Days, .@Time_Left / 86400;
        set .@Time_Left, .@Time_Left - (.@Days * 86400);
        set .@Hours, .@Time_Left / 3600;
        set .@Time_Left, .@Time_Left - (.@Hours * 3600);
        set .@Minutes, .@Time_Left / 60;
        set .@Time_Left, .@Time_Left - (.@Minutes * 60);
       
        set .@Time$, "";
        if( .@Days > 1 )
                set .@Time$, .@Time$ + .@Days + " days, ";
        else if( .@Days > 0 )
                set .@Time$, .@Time$ + .@Days + " day, ";
 
        if( .@Hours > 1 )
                set .@Time$, .@Time$ + .@Hours + " hours, ";
        else if( .@Hours > 0 )
                set .@Time$, .@Time$ + .@Hours + " hour, ";
 
        if( .@Minutes > 1 )
                set .@Time$, .@Time$ + .@Minutes + " minutes, ";
        else if( .@Minutes > 0 )
                set .@Time$, .@Time$ + .@Minutes + " minutes, ";
 
        if( .@Time_Left > 1 || .@Time_Left == 0 )
                set .@Time$, .@Time$ + .@Time_Left + " seconds";
        else if( .@Time_Left == 1 )
                set .@Time$, .@Time$ + .@Time_Left + " second";
       
        return .@Time$;
}
Viewed 594 times, submitted by unknown.