Time of Day functions on micro

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi All,

I need to convert seconds since 1900 into calender format and back
again, just like mktime etc. I wish to do this on a microcontroller with
no time libraries.

Does anyone have the source code for this function?

Regards
Wayne





Re: Time of Day functions on micro

Quoted text here. Click to load it

30 seconds on Google came up with this link....
http://samba.org/doxygen/samba_2_2/replace_8c-source.html

Peter


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com ).
We've slightly trimmed the long signature. Click to see the full one.
Re: Time of Day functions on micro
Quoted text here. Click to load it

...which is clearly marked as GNU GPL code. You can't simply lift those
sources for your own benefit.

Rob



Re: Time of Day functions on micro
Quoted text here. Click to load it

Sure you can.  You just can't lift them for your *sole* benefit,
and you must make the source of your own code available.  If that
hurts you are perfectly free to contact the copyright holder and
dicker for your own license.

--
Chuck F ( snipped-for-privacy@yahoo.com) ( snipped-for-privacy@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
We've slightly trimmed the long signature. Click to see the full one.
Re: Time of Day functions on micro
On Tue, 10 Feb 2004 13:53:51 +0100, "Rob Turk"

Quoted text here. Click to load it
Have a look for mktime in the NEWLIB sources.  They do not have
GPL or LGPL restrictions.  Might also try the various BSD sources.

Regards
-Bill Knight
R O SoftWare


Re: Time of Day functions on micro

Quoted text here. Click to load it

Thanks Peter!

over two hours on google found nothing that I could use. I must of been
searching for the wrong stuff!

Regards
Wayne


Re: Time of Day functions on micro
Wayne Peacock schrieb:
Quoted text here. Click to load it
You might also google for Minix. The Minix sources also contain a
readable implementation and the license is quite liberal now (like
public domain, if I remember correctly).

Guido

Re: Time of Day functions on micro
Quoted text here. Click to load it


What type of micro.  Note that if you start the epoch in 1900, the
numbers you'll have to handle are pretty huge (using a 32 bit unsigned
int, it'll still run over in 2036).  That might well stretch, e.g., an
8-bit micro beyond reasonable limits.  Year 2000 makes for a
considerably easier choice of epoch.  To put it another way: does your
embedded system really have to deal with calender dates from the
*past*?

Quoted text here. Click to load it

GNU libc, or any other sufficiently free implementation of libc,
should do.  Most of those will be assuming seconds since 1970, but
that shouldn't pose an extra problem.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Time of Day functions on micro

Quoted text here. Click to load it

I'm using a AVR with Codevision and yes it does deal with 32bit
unsigned. I am processing Network Time Protocol data from ethernet and
therefore require seconds since 1900.

Thanks for all you help!

Wayne


Re: Time of Day functions on micro
[...]
Quoted text here. Click to load it

Ah.  (...reads RFC on NTP...) I wouldn't ever have guessed these guys
would still have a hardwired "Y2K" type of problem in the protocol,
but they do.  NTP will overflow in 2036, and so will your product.

Now, for a normal piece of software I wouldn't let that bother me, but
for an embedded system, there could be a non-negligible chance some of
your devices will still be in operation in 2036 --- how to you plan on
handling that?

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Time of Day functions on micro
Quoted text here. Click to load it

You can always use the trick of checking for the time
value < 2**31 and shift the base forward to 2036.  This
will get you by until 2104 by which time it's someone
else's problem!

Site Timeline