[SGVLUG] timediff - my 1st ever C program that I have GPLd

Claude Felizardo cafelizardo at gmail.com
Wed Jan 5 01:51:30 PST 2011


Cool.
Actually I could use a program to calculate the diff given time stamps
from say syslog or what ever.  It would be nice if it could various
formats with optional date and/or time components and calculate the
difference and printing the diff in either seconds or hh:mm:ss, etc.
For example, I might want want to be able to cut and paste the time
stamps to find the interval between two or more events in
/var/log/messages

timediff Jan  5 01:45:01 01:47:35

Note how I have left off the date component of the 2nd datetime.
It would return the difference in both mm:ss and well as total seconds.

Bonus if it could handle more than two datetime on the command line or
possibly read from stdin calculating the diff between each entry until
end of file.

claude



On Tue, Jan 4, 2011 at 9:38 PM, juanslayton @dslextreme.com
<juanslayton at dslextreme.com> wrote:
> You put it up on Savannah yet?
> John
>
> On Tue, Jan 4, 2011 at 8:34 PM, Robert Leyva <mrflash818 at geophile.net>
> wrote:
>>
>> A C-language program of something simple, and fun, to calculate the
>> difference between two dates, for using in a shell script, for example :)
>>
>> http://mrflash818.geophile.net/php/clang/index.php
>>  ...and...
>> http://mrflash818.livejournal.com/108407.html
>>
>> I created it because I wanted to figure out some quick averages for kWh
>> consumption, but could not find a simple preexisting program that does
>> differences in time as a command line and stand alone program.
>>
>>
>> --
>> "Knowledge is Power" -- Francis Bacon
>>
>> Robert Leyva
>> mrflash818 at geophile.net
>>
>>
>
>


More information about the SGVLUG mailing list