NANY 2013 Entry Information
| Application Name | tmdiff |
| Short Description | A collection of C functions to aid in output of time differences |
| Supported OSes | Anything with a decent C compiler. |
| Web Page | https://bitbucket.org/jibsen/tmdiff |
| Version History | https://bitbucket.org/jibsen/tmdiff/commits/all |
| Author | Jibz |
Description
This is an attempt at solving the problem of formatting the difference between two points in time in a manner similar to the strftime() function. It was based on a discussion about PBoL.
The problem is; given a start date and time, and an end date and time, format a string with values showing the difference in years, months, days, hours, minutes, and seconds between the two.
Because months and years contain a varying number of days, we cannot simply compute these from difftime().
For instance, the difference between Jan 31st and Mar 1st is sometimes 29 days, sometimes 30 days, but always one month and one day. The difference between Jul 2nd and Aug 1st is 30 days, but not a month.
For a more detailed description of the problem, check this blog post.
Functions
tmdiff() is a low-level function that does the actual work of computing the time difference between two tm structs.
sftmdiff() and wsftmdiff() provide formatted output of the time difference between two tm structs.
asctmdiff() and wasctmdiff() provide a more generic textual representation.










