Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Time Elapsed function: Answered my own question.
Message
De
16/07/1997 19:39:15
 
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00040258
Message ID:
00040328
Vues:
29
Your code fails if the number of hours or minutes is zero.

Vlad

>Well, I hate sloppy code, so here is the new code using the SECONDS() function. It is considerably smaller:
>
>****************************************************************************
>Procedure R_TimeElapsed &&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>****************************************************************************
>PARAMETERS pTimeStart,pTimeEnd
>
>PRIVATE xElapsed,xSec,xMin,xHour,xReturn
>
>if pTimeStart > pTimeEnd
> xElapsed = (24*60*60)-pTimeStart+pTimeEnd
>else
> xElapsed = pTimeEnd - pTimeStart
>endif
>
>if xElapsed >= 3600
> xHours = Int(xElapsed/3600)
> xElpased = xElapsed - (3600*xHours)
>endif
>if xElapsed >= 60
> xMin = Int(xTime/60)
> xElapsed = xElapsed - (60*xMin)
>endif
>xSec = xElapsed
>xReturn = ALLTRIM(STR(xHour))+"h "+ALLTRIM(STR(xMin))+"m ";
> +ALLTRIM(STR(xSec))+"s"
>
>Return xReturn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform