[nzlug] Time Calculator

Daniel Lawson daniel at meta.net.nz
Fri Jan 12 16:16:56 NZDT 2007


Marvin Pascual wrote:
> Hello all,
>
> On 1/12/07, N Dempsey <NevilleD.AuckLug at sgr-a.net> wrote:
>> Hi Marvin,
>>
>> You can pretty much do the following calculation in your choice of
>> language (including C, perl and gawk).  I used python to demonstrate,
>> the code finds the date/time 1 million seconds from the given date/time.
>
> - - - < s n i p > - - -
>
> Thanks to all who responded.  All of your suggestions were good enough
> and powerful.  But I'm just looking for a very simple time calculator
> that can just do a simple calculations like add, subtract, multiply
> and divide a time with the following format:  "HH:MM:SS.MS".  This
> time format comes from the "time" command.

To clarify: You want to be able to say something like:

00:10:00.00 * 20 = 03:20:00.00     (10 minutes * 20  is 3 hours 20 minutes)

00:45:00.00 + 00:20:00.00 = 01:05:00.00   (45 minutes + 20 minutes is 1
hour and 5 minutes)

eg: Take a formatted time, and apply those math functions to it.  Is
that about right?






More information about the NZLUG mailing list