ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > N.A.N.Y. 2013

NANY 2013 Submission - tmdiff - Formatted Output of Time Differences in C

(1/1)

Jibz:
NANY 2013 Entry Information
Application NametmdiffShort DescriptionA collection of C functions to aid in output of time differencesSupported OSesAnything with a decent C compiler.Web Pagehttps://bitbucket.org/jibsen/tmdiffVersion Historyhttps://bitbucket.org/jibsen/tmdiff/commits/allAuthorJibz

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.

Jibz:
Reserved.

mouser:
Glad to see you participating in NANY this year, Jibz!
And yes, for anyone wondering, although this is a library for programmers, this qualifies as a NANY under our loose guidelines.

 :up:

By the way, I love the way your bitbucket documentation page looks.  Very readable.

Navigation

[0] Message Index

Go to full version