viewing paste time_RU | 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 + " дней, ";
    else if( .@Days > 0 )
        set .@Time$, .@Time$ + .@Days + " день, ";
 
    if( .@Hours > 1 )
        set .@Time$, .@Time$ + .@Hours + " часов, ";
    else if( .@Hours > 0 )
        set .@Time$, .@Time$ + .@Hours + " час, ";
 
    if( .@Minutes > 1 )
        set .@Time$, .@Time$ + .@Minutes + " минут, ";
    else if( .@Minutes > 0 )
        set .@Time$, .@Time$ + .@Minutes + " минуты, ";
 
    if( .@Time_Left > 1 || .@Time_Left == 0 )
        set .@Time$, .@Time$ + .@Time_Left + " секунд";
    else if( .@Time_Left == 1 )
        set .@Time$, .@Time$ + .@Time_Left + " секунды";
    
    return .@Time$;
}
Viewed 688 times, submitted by Guest.