After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 415160 - getElapsedTime counts mistaken time.
getElapsedTime counts mistaken time.
Status: RESOLVED FIXED
Product: LDTP
Classification: Other
Component: ldtprunner
0.8.x
Other Linux
: Normal normal
: ---
Assigned To: LDTP maintainers
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2007-03-06 02:55 UTC by lavi
Modified: 2007-03-07 06:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description lavi 2007-03-06 02:55:43 UTC
The number of hour was error when _endTime great then 60.

Fixed here :)
def getElapsedTime (_endTime, _startTime):
    timeDiff = _endTime - _startTime
    hours = int (timeDiff / 3600)
    seconds = int (timeDiff - hours*3600)
    minutes = int (seconds / 60)
    seconds = int (seconds - minutes*60)
    days = 0
    fmt = ''
    if hours > 24:
        hours   = int (hours  % 24)
        days = int (hours / 24)
        fmt = str (days) + ' day(s) '
    fmt = fmt + str (hours) + ':' + str (minutes) + ':' + str (seconds)
    return fmt
Comment 1 lavi 2007-03-06 09:09:48 UTC
Sorry, fixed again.

def getElapsedTime (_endTime, _startTime):
    timeDiff = _endTime - _startTime
    minbaseon = 60
    hourbaseon = minbaseon*60
    daybaseon = hourbaseon*24
    days = int (timeDiff / daybaseon)
    hours = int ((timeDiff - days*daybaseon) / hourbaseon)
    seconds = int (timeDiff  - days*daybaseon - hours*hourbaseon)
    minutes = int (seconds / minbaseon)
    seconds = int (seconds - minutes*minbaseon)

    return ('%s day(s) %s:%s:%s' %
           (str (days), str (hours), str (minutes), str (seconds)))
Comment 2 lavi 2007-03-06 09:19:53 UTC
def getElapsedTime (_endTime, _startTime):
    timeDiff = _endTime - _startTime
    minbaseon = 60
    hourbaseon = minbaseon*60
    daybaseon = hourbaseon*24
    days = int (timeDiff / daybaseon)
    hours = int ((timeDiff - days*daybaseon) / hourbaseon)
    minutes = int ((timeDiff - days*daybaseon - hours*hourbaseon) / minbaseon)
    seconds = int (timeDiff  - days*daybaseon - hours*hourbaseon - minutes*minbaseon)

    if days > 0:
        return ('%s day(s) %s:%s:%s' %
           (str (days), str (hours), str (minutes), str (seconds)))
    else:
        return ('%s:%s:%s' %
           (str (hours), str (minutes), str (seconds)))
Comment 3 Nagappan Alagappan 2007-03-07 06:43:58 UTC
Fixed in CVS. Thanks for the patch :)