Advanced Search
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
May 20, 2012, 02:13:01 AM
Home
Help
Calendar
Login
Register
News
: Welcome to GLomation peer support forum
Glomation
»
General Category
»
General Discussion
»
RTC Date Math
« previous
next »
Pages: [
1
]
Topic Tools
Topic Tools
Send this topic
Print
July 22, 2009, 11:04:42 AM
#0
davest
davest
Show davest's last posts.
Show general stats for davest.
Super Hero
Posts: 22
RTC Date Math
Hi,
I have spent more time than I can afford searching for this so I am guessing it is odd enough to ask about.
Because our product is expected to run for long periods of time, we are moving RTC functions to an external board that houses IO and other features. This allows us to use 50/60 Hz line frequency as a double check against a crystal clock.
The external RTC will provide elapsed seconds from a reset point. I can easily do math to handle adding those seconds to a base HH:MM:SS to get current time. The harder part is adding a count of days to a base date and getting a correct current date. Does Linux (or more specifically, emdebian Linux) provide functions for doing date math? If not, does anyone know of a reliable block of code I could use to implement the math?
Thanks in advance for any help.
Dave S.
July 23, 2009, 09:55:02 AM
#1
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 342
Re: RTC Date Math
There are standard time conversion function in C library. The Unix/Linux time is actually kept as elapsed seconds since 1/1/1970. You can use the library function to convert date and time of the reset point to seconds since 1/1/1970 and add the elapsed time since reset point then convert it back to date and time.
July 28, 2009, 11:08:46 AM
#2
davest
davest
Show davest's last posts.
Show general stats for davest.
Super Hero
Posts: 22
Re: RTC Date Math
Thanks for the reply.
I have researched Linux functions in the past only to find that they are not available in the 'reduced fat' emdebian version libraries supplied with the 9260.
Is there a concise list somewhere of what functions are in the 9260 libraries? -OR- Is there a utility I can run that will explore the libraries and generate a list?
David S.
July 28, 2009, 11:47:35 AM
#3
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 342
Re: RTC Date Math
The time/date functions are in the standard C library and they should be available even in the embedded file system that is installed from the factory. You can link your program with the library statically if the functions are not in the file system.
July 30, 2009, 01:26:46 PM
#4
davest
davest
Show davest's last posts.
Show general stats for davest.
Super Hero
Posts: 22
Re: RTC Date Math
Hi,
Thanks for the response, but...
It is not a direct answer to my question.
Let's take a specific example. I would like to use the function 'clock_gettime'. I can find information on the web that describes how it works and the passed parameters. It is referenced in the 'arm' include files so the compiler accepts it in code. The linker however says it cannot find the function.
How do I find out what 'arm' library to include to satisfy the linker? I already have a '-lpthread' in my makefile to satisfy some threading functions. Where are the actual libraries and how do I find out what I have to work with?
Dave S.
July 30, 2009, 01:39:01 PM
#5
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 342
Re: RTC Date Math
You can use standard C library functions. They are processor independent and should be system independent also most of the time. Please take a look of
http://en.wikipedia.org/wiki/Time.h
Pages: [
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Announcements
=> General Discussion
=> Programming Tips, Recommendded Readings, etc.
-----------------------------
Peer Support Forums
-----------------------------
=> GESBC-9302
=> GESBC-9260
=> GESBC-9G20
=> GESBC-2440
=> GESBC-9315
Loading...