Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/06/12 06:10
Read: times


 
#188249 - Cross-checking important
Responding to: ???'s previous message
Of course, it's always important to validate all assumptions.

Your post seems to indicate that this is a problem with the posted code you found. I would say it's a problem with your asssumption of how to use the code.

Note that the standard CRTL functions gmtime(), localtime(), mktime() etc uses a data structure named "struct tm", where month is zero-based while day of month is one-based. So there are lots of source code on the net that requires january to be zero just because the posted code is intended for use inside the CRTL.

Another thing - the code you uses also subtracts 1970 from the year. Unix epoch is 1970-01-01 00:00. So the time_t data type in C is zero at midnight at crossover from 1969 to 1970.

But another issue.
Your epoch value 1346867100 should have been Wed, 05 Sep 2012 17:45:00 GMT. So you seem to be 4 days off.
However, I assume that is an error in your post because your original post did claim that you called the function with parameters specifying september 5th.



List of 22 messages in thread
TopicAuthorDate
Error in conversion from Unix EPOCH             01/01/70 00:00      
   zero            01/01/70 00:00      
   DMonth[month-1] ????            01/01/70 00:00      
      Stefan is correct and...            01/01/70 00:00      
         +4 - 100 + 400            01/01/70 00:00      
            right, but...            01/01/70 00:00      
               88 years is a long time            01/01/70 00:00      
                  That is what they said in the 60's            01/01/70 00:00      
      Thanks. Problem solved            01/01/70 00:00      
         Cross-checking important            01/01/70 00:00      
            Just a foot note about the year            01/01/70 00:00      
               ?back conversion            01/01/70 00:00      
                  No - multiplier should not be 366            01/01/70 00:00      
                     Running out of seconds > 1970            01/01/70 00:00      
                        signed is actually common - to support dates before 1970            01/01/70 00:00      
                        Will You Now.            01/01/70 00:00      
                           Have you considered leap seconds?            01/01/70 00:00      
                              Leap seconds can almost always be ignored            01/01/70 00:00      
                                 Time is passing anyway or is it just an illusion?            01/01/70 00:00      
                                    Missiles? Leap seconds contra way larger drift...            01/01/70 00:00      
         No such thing as a free lunch!            01/01/70 00:00      
   Link?            01/01/70 00:00      

Back to Subject List