Sunday, October 4, 2009

[LINUX_Newbies] Re: Format of time and date to send to Linux system?

 

On 04Oct2009 15:56, lslonim2 <lslonim@our3cats.com> wrote:
| Hi. I'm an embedded programmer, doing code for a board that is part of a distributed system that will interface to a Linux central controller. My board does not run an OS.
| I need to send time and date info from an on-board battery backed clock to the Linux system for time-stamping events, and it needs to send me info if my clock has a dead battery.
| I'm trying to find out what format Linux wants, so that when I send it up to central, the guy handling that end will have less work to do. There's nobody to ask yet since that job isn't filled.
| My clock chip is hh:mm:ss. In searching the web, it seems Linux time is kept as a raw time since 1970, but my little processor can't handle the work to go into and out of that format.
| So my question is: Is there a standard Linux format for transmitting time in hh:mm:ss format, and if so, what are the system calls that use it?

Just send hh:mm:ss and make sure your Linux guy knows the format. It's
pretty trivial to convert a "human" time into a UNIX seconds-since-1970
on the Linux machine using standard library calls present on all UNIX
machines, specificly the ones using the "tm" struct.

If you only have hh:mm:ss then the Linux end will have to assume today's date
but that's easily done. It will also need to know the timezone your embedded
box is using (personally I would go with GMT/UTC if you can trust the people
configuring your board to set it correctly - no summer time issues or other
things to worry about).

Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Theoretical Physicist,N.:A physicist whose existence is postulated, to make
the numbers balance but who is never actually observed in the laboratory.

__._,_.___
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
Recent Activity
Visit Your Group
Give Back

Yahoo! for Good

Get inspired

by a good cause.

Y! Toolbar

Get it Free!

easy 1-click access

to your groups.

Yahoo! Groups

Start a group

in 3 easy steps.

Connect with others.

.

__,_._,___

No comments:

Post a Comment