Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #31234
| From | pozz <pozzugno@gmail.com> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | newlib and time() |
| Date | 2022-09-30 08:29 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <th62c5$ufge$1@dont-email.me> (permalink) |
I often use newlib standard C libraries with gcc toolchain for Cortex-M
platforms. It sometimes happens I need to manage calendar time: seconds
from 1970 or broken down time. And it sometimes happens I need to manage
timezone too, because the time reference comes from NTP (that is UTC).
newlib as expected defines a time() function that calls a syscall
function _gettimeofday(). It should be defined as in [1].
What is it? There's an assembler instruction that I don't understand:
asm ("swi %a1; mov %0, r0" : "=r" (value): "i" (SWI_Time) : "r0");
What is the cleanest way to override this behaviour and let newlib
time() to return a custom calendar time, maybe counted by a local RTC,
synchronized with a NTP?
The solution that comes to my mind is to override _gettimeofday() by
defining a custom function.
[1] https://github.com/eblot/newlib/blob/master/libgloss/arm/syscalls.c
Back to comp.arch.embedded | Previous | Next — Next in thread | Find similar | Unroll thread
newlib and time() pozz <pozzugno@gmail.com> - 2022-09-30 08:29 +0200
Re: newlib and time() David Brown <david.brown@hesbynett.no> - 2022-09-30 09:04 +0200
Re: newlib and time() pozz <pozzugno@gmail.com> - 2022-09-30 11:29 +0200
Re: newlib and time() Clifford Heath <no_spam@please.net> - 2022-09-30 21:51 +1000
Re: newlib and time() pozz <pozzugno@gmail.com> - 2022-09-30 15:32 +0200
Re: newlib and time() Richard Damon <Richard@Damon-Family.org> - 2022-09-30 09:48 -0400
Re: newlib and time() Clifford Heath <no_spam@please.net> - 2022-10-01 08:43 +1000
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2022-09-30 11:55 -0700
Re: newlib and time() Clifford Heath <no_spam@please.net> - 2022-10-01 08:48 +1000
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2022-09-30 16:11 -0700
Re: newlib and time() David Brown <david.brown@hesbynett.no> - 2022-09-30 14:38 +0200
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2022-09-30 11:42 -0700
Re: newlib and time() pozz <pozzugno@gmail.com> - 2022-10-03 00:09 +0200
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2022-10-02 19:02 -0700
Re: newlib and time() pozz <pozzugno@gmail.com> - 2022-12-30 17:08 +0100
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2022-12-30 17:35 -0700
Re: newlib and time() pozz <pozzugno@gmail.com> - 2023-01-04 17:09 +0100
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2023-01-04 12:19 -0700
Re: newlib and time() George Neuner <gneuner2@comcast.net> - 2023-01-04 20:12 -0500
Re: newlib and time() Don Y <blockedofcourse@foo.invalid> - 2023-01-04 19:40 -0700
Re: newlib and time() Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2022-10-03 10:20 +0300
Re: newlib and time() Clifford Heath <no_spam@please.net> - 2022-09-30 17:12 +1000
Re: newlib and time() Theo <theom+news@chiark.greenend.org.uk> - 2022-09-30 14:06 +0100
csiph-web