| | |
Problem calculating days between 2 dates
![]() |
•
•
•
•
>>difftime()
I see absolutely no value in that function because all it does is subtract the two parameter values and return the result as a double. When time_t is an (unsigned)integer then the double return value is just plain inconvenient because it would have to be typecast back to time_t. So the program might as well just subtract the two time_t objects and be done with it.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
•
•
>>that rather than doing it the "right" way, the "easy" way was chosen?
You consider calling a function just to subtract two numbers is the "right way"What a waste of cpu time.
time_t is a measure of seconds. This is not necessarily true. Is writing potentially buggy code a better use of CPU time? Last edited by Dave Sinkula; Jun 19th, 2009 at 4:02 pm.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
•
•
Time type
Type capable of representing times and support arithmetical operations.
This type is returned by the time function and is used as parameter by some other functions of the <ctime> header.
It is almost universally expected to be an integral value representing the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC. This is due to historical reasons, since it corresponds to a unix timestamp, but is widely implemented in C libraries across all platforms.
![]() |
Similar Threads
- Need Help Calculating Days Active based on dates (Visual Basic 4 / 5 / 6)
- calculating the difference between 2 dates (Visual Basic 4 / 5 / 6)
- how to calculate the days between two dates excluding saturday and sunday (JavaScript / DHTML / AJAX)
- Calculate working days between dates (PHP)
- problem calculating cost (C++)
- array structs, size swap functions, the amount of days between to dates (C++)
- help calculating days (C++)
Other Threads in the C Forum
- Previous Thread: 13th friday in c
- Next Thread: How to swap rows in single diemensional array
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o include incrementoperators input interest kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue mysql number odf open opensource owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling segmentationfault send sequential shape socket socketprograming stack standard string systemcall turboc unix user voidmain() wab win32api windows.h






