Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #31248

Re: newlib and time()

From pozz <pozzugno@gmail.com>
Newsgroups comp.arch.embedded
Subject Re: newlib and time()
Date 2022-10-03 00:09 +0200
Organization A noiseless patient Spider
Message-ID <thd269$1rfjh$1@dont-email.me> (permalink)
References <th62c5$ufge$1@dont-email.me> <th64eh$uo0n$1@dont-email.me> <th6cu8$ufgd$1@dont-email.me> <th7da7$12qsd$1@dont-email.me>

Show all headers | View raw


Il 30/09/2022 20:42, Don Y ha scritto:
> On 9/30/2022 2:29 AM, pozz wrote:
>> Another bonus is when you have NTP, that returns seconds in UTC, so 
>> you can set your counter with the exact number retrived by NTP.
> 
> No.  You always have to ensure that time keeps flowing in one direction.
> 
> So, time either "doesn't exist" before your initial sync with the
> time server (what if the server isn't available when you want to
> do that?)

At startup, if NTP server is not available and I don't have any notion 
of "now", I start from a date in the past, i.e. 01/01/2020.


> *or* you have to look at your current notion of "now"
> and ensure that the "real" value of now, when obtained from the
> time server, is always in the future relative to your notion.

Actually I don't do that and I replace the timer counter with the value 
retrieved from NTP.
What happens if the local timer is clocked by a faster clock then 
nominal? For example, 16.001MHz with 16M prescaler.
If I try to NTP re-sync every 1-hour, it's probably the local counter is 
greater than the value retrieved from NTP. I'm forced to decrease the 
local counter, my notion of "now".

What happens if the time doesn't flow in one direction only?


> [Note that NTP slaves don't blindly assume the current time is
> as reported but *slew* to the new value, over some interval.]
> 
> This also ignores the possibility of computations with relative
> *intervals* being inconsistent with these spontaneous "resets".
> 

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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