Go Down

Topic: Time and RTC libs - question on date and time integrity (Read 5 times) previous topic - next topic


Jul 31, 2012, 09:50 pm Last Edit: Jul 31, 2012, 09:56 pm by pito Reason: 1
One positive thing about the Time.cpp library is it uses "time_t" what is the unix_time. So the rtc chip library needs to convert the rtc date and time to time_t, all the other functions are various formatting exercises around time_t only..
So the rtc_chip_lib shall include ~4 functions only: getDateAndTime(), setDateAndTime() and the same with Alarm..


The Time library does not produce Unix/POSIX time.  The standard for the POSIX epoch is 1970-01-01 00:00:00 UTC.

Not the number of seconds from some random local time.  POSIX time is the same in every time zone at a given instant.



This is what I get (UTC):
07/31/2012  22:29:58  1343773798


Jul 31, 2012, 10:36 pm Last Edit: Jul 31, 2012, 10:42 pm by fat16lib Reason: 1
So what?  Time can not convert between POSIX time and local time since it doesn't know about time zones.  It is not a POSIX time library.

You must be two hours east of Zulu time. Well one hour plus summer time.


I wrote several RTC GPS date time libraries. 

The most complete library uses UTC for RTC chips and GPS.  It handles time zones and daylight/summer time. It can format date time in ISO formats or other custom formats.  It has all popular POSIX conversions between epoch time and local/UTC.  It has a database and algorithms for common DST rules.

This library is overkill for most users so I never posted it.


This is more of a problem of knowing what users need than writing code.  Once you know the requirements code is easy.

Several months ago, I bought a do-it-yourself alarm clock called the Alpha Clock Five. I bought it with the intention of modifying it to show the date as well as the time, and also to show seconds. I found it immensely difficult to modify to my liking. Maybe I'm not much of a coder.

What I would have found extremely useful during the process would have been a library like the one you describe. What I would like to know, though, is two things:

  • How fast does your library run? This clock uses a multiplexed LED display: would I see constant flickering while the time is being recalculated?

  • I made a display mode which shows the time in increments of 1/8 minute. This is 7.5 seconds per increment. Can your library handle the half second?

Please post your library so I can have a look at it.

Some functions I have written are here: http://arduino.cc/forum/index.php/topic,101401.0.html

Go Up