Re: Time Calculation

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: Jeff Zeitlin <jzeitlin at CYBURBAN.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, November 28, 1999 12:38 AM
Subject: Re: Time Calculation

> If _very_ long shifts are a possibility (e.g., start at 10AM,
> finish at 2AM next morning), you'll also want to check to see if
> the end time is earlier than the start time, and if they are,
> swap them, calculate the difference, and then subtract that
> difference from 24 hours.  That will cover everything except a
> shift that's 24 hours or longer.

This would work best if you logged the ticks from start of something, rather
than the calendar/clock time. Maybe Rob could put in a function to convert a
date/time to ticks_since_epoch, and back again. That way you can convert the
start time to ticks, then the end time, subtract, and you're done, with no
errors.

; given a start time of 943811806
; echo -s $ctime
943813806
; echo -s $duration($calc(943813806 - 943811806))
33mins 20secs

; given a start time of 943201806
; echo -s $ctime
943813806
; echo -s $duration($calc(943813806 - 943201806))
1wk 2hrs


; given a start time of 943201806
; echo -s $ctime
943813806
; echo -s $duration($calc(943813806 - 943201806))
15hrs 16mins 40secs


Kat,
musing

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu