<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Looks good, tried some forced reconnects, no crashes.<br>
    <br>
    Also cooperating nicely on the time:<br>
    <br>
    <tt>OVMS > time status </tt><tt><br>
    </tt><tt>UTC Time:   Sat Mar  3 11:05:36 2018</tt><tt><br>
    </tt><tt>Local Time: Sat Mar  3 12:05:36 2018</tt><tt><br>
    </tt><tt>Provider:   ntp</tt><tt><br>
    </tt><tt><br>
    </tt><tt>PROVIDER             STRATUM  UPDATE TIME</tt><tt><br>
    </tt><tt> gsm-nmea                  2       1 Sat Mar  3 11:05:37
      2018</tt><tt><br>
    </tt><tt>*ntp                       1     264 Sat Mar  3 11:05:36
      2018</tt><tt><br>
    </tt><br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 03.03.2018 um 10:24 schrieb Mark
      Webb-Johnson:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E0AE165B-154D-43FF-A106-683F892E6652@webb-johnson.net">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      Although apparent in SNTP, I think the core issue here is in
      ovms_netmanager.
      <div class=""><br class="">
      </div>
      <div class="">When wifi goes down, that issued a
        network.reconfigured event followed by a network.down event. The
        network.reconfigured causes a stop/start of sntp and I guess
        there is a race condition there.</div>
      <div class=""><br class="">
      </div>
      <div class="">Best fix is to change ovms_netmanager so that
        network.reconfigured is NOT issued if the network is down (only
        if say two networks were up, and one went down, so one is still
        up).</div>
      <div class=""><br class="">
      </div>
      <div class="">I’ve also moved the SNTP init code into module
        startup (rather than network availability) to try to work around
        the race condition in SNTP.</div>
      <div class=""><br class="">
      </div>
      <div class="">Regards, Mark</div>
      <div class=""><br class="">
        <div>
          <blockquote type="cite" class="">
            <div class="">On 3 Mar 2018, at 2:38 AM, Michael Balzer <<a
                href="mailto:dexter@expeedo.de" class=""
                moz-do-not-send="true">dexter@expeedo.de</a>> wrote:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <meta http-equiv="Content-Type" content="text/html;
                charset=utf-8" class="">
              <div text="#000000" bgcolor="#FFFFFF" class=""> Just
                fetched the latest updates, now getting a crash / reboot
                as soon as the ppp gets an IP:<br class="">
                <br class="">
                <tt class="">I (45514) gsm-ppp: StatusCallBack: None</tt><tt
                  class=""><br class="">
                </tt><tt class="">I (45514) gsm-ppp: status_cb:
                  Connected</tt><tt class=""><br class="">
                </tt><tt class="">I (45514) gsm-ppp:    our_ipaddr  =
                  10.170.195.13</tt><tt class=""><br class="">
                </tt><tt class="">I (45514) gsm-ppp:    his_ipaddr  =
                  10.64.64.64assertion "Operating mode must not be set
                  while SNTP client is running" failed: file
                  "/home/balzer/esp/esp-idf/components/lwip/apps/sntp/sntp.c",
                  line 604, function: sntp_setopera</tt><tt class="">tingmode</tt><tt
                  class=""><br class="">
                </tt><tt class="">abort() was called at PC 0x400f6e2f on
                  core 0</tt><tt class=""><br class="">
                </tt><tt class=""><br class="">
                </tt><tt class="">Backtrace: 0x4008f64c:0x3ffcc770
                  0x4008f823:0x3ffcc790 0x400f6e2f:0x3ffcc7b0
                  0x401935f5:0x3ffcc7e0 0x400e237a:0x3ffcc800
                  0x400e2a5c:0x3ffcc820 0x400e6c45:0x3ffcc860
                  0x400e6ecc:0x3ffcc890 0x400e9249:0x3ffcc920
                  0x400e9ab8:0x3ffc</tt><tt class=""><br class="">
                </tt><tt class="">c990 0x400e6c45:0x3ffcc9d0
                  0x400e6ecc:0x3ffcca00 0x40126a3a:0x3ffcca90
                  0x401a20ad:0x3ffccb00 0x401a2f46:0x3ffccb20
                  0x401a5fbb:0x3ffccb40 0x401a61b2:0x3ffccb60
                  0x401a2873:0x3ffccb80 0x401a1d71:0x3ffccba0
                  0x401a25e8:0x3ffccbd0 0</tt><tt class=""><br class="">
                </tt><tt class="">x401a2735:0x3ffccbf0
                  0x4018f581:0x3ffccc10</tt><tt class=""><br class="">
                </tt><tt class=""><br class="">
                </tt><tt class="">Rebooting...</tt><tt class=""><br
                    class="">
                </tt><br class="">
                <br class="">
                Switching esp-idf to the new branch
                origin/sntp-extension didn't help.<br class="">
                <br class="">
                Regards,<br class="">
                Michael<br class="">
                <br class="">
                <br class="">
                <div class="moz-cite-prefix">Am 26.02.2018 um 08:54
                  schrieb Mark Webb-Johnson:<br class="">
                </div>
                <blockquote type="cite"
                  cite="mid:4EBA50ED-F79F-461B-A274-BC9F58156675@webb-johnson.net"
                  class="">
                  <meta http-equiv="Content-Type" content="text/html;
                    charset=utf-8" class="">
                  <div class=""><br class="">
                  </div>
                  <div class="">Not too bad, so long as you live in a
                    sensible area without DST :-)</div>
                  <div class=""><br class="">
                  </div>
                  <blockquote style="margin: 0 0 0 40px; border: none;
                    padding: 0px;" class="">
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class="">OVMS >
                            config list vehicle</span></font></div>
                    </div>
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class="">vehicle
                            (readable writeable)</span></font></div>
                    </div>
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class="">  id:
                            TESTCAR</span></font></div>
                    </div>
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class="">  name:</span></font></div>
                    </div>
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class=""> 
                            timezone: HKT-8</span></font></div>
                    </div>
                    <div class="">
                      <div class=""><font class="" face="Andale Mono"><span
                            style="font-size: 18px;" class=""> 
                            units.distance: K</span></font></div>
                    </div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class=""><br class="">
                        </span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">OVMS >
                          time set 1519631172</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">Time set (at
                          stratum 15)</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class=""><br class="">
                        </span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">OVMS >
                          time</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">UTC Time:  
                          Mon Feb 26 07:46:13 2018</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">Local Time:
                          Mon Feb 26 15:46:13 2018</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">Provider:  
                          time</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class=""><br class="">
                        </span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">PROVIDER    
                                  STRATUM  UPDATE TIME</span></font></div>
                    <div class=""><font class="" face="Andale Mono"><span
                          style="font-size: 18px;" class="">*time      
                                        15       1 Mon Feb 26 07:46:13
                          2018</span></font></div>
                  </blockquote>
                  <div class=""><br class="">
                  </div>
                  <div class="">It is also mapped as parameter #23 for
                    OVMS server v2.</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">Committed to github. I’ll look at SNTP
                    next.</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">Regards, Mark.</div>
                  <div class=""><br class="">
                    <blockquote type="cite" class="">
                      <div class="">On 26 Feb 2018, at 1:40 PM, Mark
                        Webb-Johnson <<a
                          href="mailto:mark@webb-johnson.net" class=""
                          moz-do-not-send="true">mark@webb-johnson.net</a>>
                        wrote:</div>
                      <br class="Apple-interchange-newline">
                      <div class="">
                        <meta http-equiv="Content-Type"
                          content="text/html; charset=utf-8" class="">
                        <div style="word-wrap: break-word;
                          -webkit-nbsp-mode: space; line-break:
                          after-white-space;" class="">
                          <div class=""><br class="">
                          </div>
                          I’ve extended ovms_time to also
                          include suseconds_t timu, if available.
                          <div class=""><br class="">
                          </div>
                          <div class="">I think NTP can be done within
                            ovms_time, as an ‘ntp’ source in a similar
                            way to the ‘time’ source for manual
                            configuration. The issue I am hitting is
                            finding out when the time has actually been
                            set. It seems that LWIP SNTP doesn’t provide
                            any facility to expose that. There is a
                            macro SNTP_SET_SYSTEM_TIME_US that is
                            defined in the Espressif LWIP options file
                            as:</div>
                          <div class=""><br class="">
                          </div>
                          <blockquote style="margin: 0 0 0 40px; border:
                            none; padding: 0px;" class="">
                            <div class="">
                              <div class=""><font class="" face="Andale
                                  Mono"><span style="font-size: 18px;"
                                    class="">#define
                                    SNTP_SET_SYSTEM_TIME_US(sec, us)  \</span></font></div>
                              <div class=""><font class="" face="Andale
                                  Mono"><span style="font-size: 18px;"
                                    class="">    do { \</span></font></div>
                              <div class=""><font class="" face="Andale
                                  Mono"><span style="font-size: 18px;"
                                    class="">        struct timeval tv =
                                    { .tv_sec = sec, .tv_usec = us }; \</span></font></div>
                              <div class=""><font class="" face="Andale
                                  Mono"><span style="font-size: 18px;"
                                    class="">       
                                    settimeofday(&tv, NULL); \</span></font></div>
                              <div class=""><font class="" face="Andale
                                  Mono"><span style="font-size: 18px;"
                                    class="">    } while (0);</span></font></div>
                            </div>
                          </blockquote>
                          <div class="">
                            <div class=""><br class="">
                            </div>
                            <div class="">but there is no easy way of
                              overriding that from a client app. It
                              seems I’m not the only one who found this:</div>
                            <div class=""><br class="">
                            </div>
                          </div>
                          <blockquote style="margin: 0 0 0 40px; border:
                            none; padding: 0px;" class="">
                            <div class="">
                              <div class=""><a
                                  href="https://www.esp32.com/viewtopic.php?f=2&t=4695"
                                  class="" moz-do-not-send="true">https://www.esp32.com/viewtopic.php?f=2&t=4695</a></div>
                            </div>
                            <div class=""><br class="">
                            </div>
                            <div class=""><span class="responsive-hide"
                                style="margin: 0px; padding: 0px;
                                border: 0px; font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                font-stretch: inherit; line-height:
                                inherit; vertical-align: baseline;
                                color: rgb(68, 68, 68);">by <span
                                  style="margin: 0px; padding: 0px;
                                  border: 0px; font-family: inherit;
                                  font-size: inherit; font-style:
                                  inherit; font-variant-caps: inherit;
                                  font-weight: 600; font-stretch:
                                  inherit; line-height: inherit;
                                  vertical-align: baseline;" class=""><a
href="https://www.esp32.com/memberlist.php?mode=viewprofile&u=4952&sid=4f2bdf4eea4ed434cf38cf94a2df7709"
                                    class="username" style="margin: 0px;
                                    padding: 0px; border: 0px;
                                    font-family: inherit; font-size:
                                    inherit; font-style: inherit;
                                    font-variant-caps: inherit;
                                    font-weight: inherit; font-stretch:
                                    inherit; line-height: inherit;
                                    vertical-align: baseline; direction:
                                    ltr; unicode-bidi: embed;
                                    text-decoration: none; color:
                                    rgb(223, 121, 128);"
                                    moz-do-not-send="true">vonnieda</a></span> » </span><span
                                style="color: rgb(68, 68, 68);
                                font-family: "Open Sans",
                                sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class="">Tue Feb 13, 2018 11:48 pm</span></div>
                            <div class=""><span style="color: rgb(68,
                                68, 68); font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class="">It's working well, but I need
                                to know when it has received a time
                                update and set the time.</span></div>
                            <div class=""><span style="color: rgb(68,
                                68, 68); font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class=""><br class="">
                              </span></div>
                            <div class=""><span class="responsive-hide"
                                style="margin: 0px; padding: 0px;
                                border: 0px; font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                font-stretch: inherit; line-height:
                                inherit; vertical-align: baseline;
                                color: rgb(68, 68, 68);">by <span
                                  style="margin: 0px; padding: 0px;
                                  border: 0px; font-family: inherit;
                                  font-size: inherit; font-style:
                                  inherit; font-variant-caps: inherit;
                                  font-weight: 600; font-stretch:
                                  inherit; line-height: inherit;
                                  vertical-align: baseline;" class=""><a
href="https://www.esp32.com/memberlist.php?mode=viewprofile&u=2849&sid=4f2bdf4eea4ed434cf38cf94a2df7709"
                                    class="username" style="margin: 0px;
                                    padding: 0px; border: 0px;
                                    font-family: inherit; font-size:
                                    inherit; font-style: inherit;
                                    font-variant-caps: inherit;
                                    font-weight: inherit; font-stretch:
                                    inherit; line-height: inherit;
                                    vertical-align: baseline; direction:
                                    ltr; unicode-bidi: embed;
                                    text-decoration: none; color:
                                    rgb(223, 121, 128);"
                                    moz-do-not-send="true">loboris</a></span> » </span><span
                                style="color: rgb(68, 68, 68);
                                font-family: "Open Sans",
                                sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class="">Wed Feb 14, 2018 8:34 am</span></div>
                            <div class=""><span style="color: rgb(68,
                                68, 68); font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class="">I've needed the same thing and
                                ended up adding the global variable </span><span
                                style="margin: 0px; padding: 0px;
                                border: 0px; font-family: "Open
                                Sans", sans-serif; font-size: 13px;
                                font-style: italic; font-stretch:
                                inherit; line-height: inherit;
                                vertical-align: baseline; color: rgb(68,
                                68, 68);" class="">sntp_is_synced</span><span
                                style="color: rgb(68, 68, 68);
                                font-family: "Open Sans",
                                sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class=""> which is set to true before
                                calling SNTP_SET_SYSTEM_TIME_US in
                                "sntp.c".</span><br style="color:
                                rgb(68, 68, 68); font-family: "Open
                                Sans", sans-serif; font-size:
                                13px;" class="">
                              <span style="color: rgb(68, 68, 68);
                                font-family: "Open Sans",
                                sans-serif; font-size: 13px;
                                background-color: rgb(255, 255, 255);"
                                class="">Not a very elegant solution
                                because I've modified the file in the
                                esp-idf, but it works fine.</span></div>
                          </blockquote>
                          <div class="">
                            <div class=""><br class="">
                            </div>
                            <div class="">Urgh. But, the Laboris
                              solution seems fairly neat and would meet
                              our requirements.</div>
                            <div class=""><br class="">
                            </div>
                            <div class="">Time zones seem messy (without
                              all those compiled zone files), but
                              workable. I’ll add it.</div>
                            <div class=""><br class="">
                            </div>
                            <div class="">Regards, Mark.</div>
                            <div class=""><br class="">
                            </div>
                            <div class="">
                              <blockquote type="cite" class="">
                                <div class="">On 25 Feb 2018, at 5:44
                                  AM, Stephen Casner <<a
                                    href="mailto:casner@acm.org"
                                    class="" moz-do-not-send="true">casner@acm.org</a>>
                                  wrote:</div>
                                <br class="Apple-interchange-newline">
                                <div class="">
                                  <div class="">Mark,<br class="">
                                    <br class="">
                                    Thanks for this.  I've made a small
                                    change to make 'status' the<br
                                      class="">
                                    default argument for the command if
                                    you don't give one.  (I made a<br
                                      class="">
                                    change to the command system this
                                    some months ago to enable this but<br
                                      class="">
                                    it hasn't been used much yet.)<br
                                      class="">
                                    <br class="">
                                    I have a few comments on the time
                                    system:<br class="">
                                    <br class="">
                                    - A full NTP daemon does much more
                                    than select among time sources by<br
                                      class="">
                                     stratum.  Given multiple sources,
                                    it also has mechanisms to try to<br
                                      class="">
                                     detect "falsetickers" (a Dave Mills
                                    term) and strategies to choose<br
                                      class="">
                                     between stepping or slewing time
                                    depending upon which is more<br
                                      class="">
                                     appropriate for the way the time
                                    source is used.<br class="">
                                    <br class="">
                                    - One of the ESP-IDF example
                                    programs is SNMP (simple NTP) using
                                    the<br class="">
                                     capability built into LwIP.  It is
                                    easy to invoke -- as a test I<br
                                      class="">
                                     just added this to console_ssh to
                                    take advantage of its existing<br
                                      class="">
                                     event notification for wifi coming
                                    up:<br class="">
                                    <br class="">
                                     @@ -32,6 +32,7 @@<br class="">
                                      #include <lwip/def.h><br
                                      class="">
                                      #include <lwip/sockets.h><br
                                      class="">
                                      #undef bind<br class="">
                                     +#include "apps/sntp/sntp.h"<br
                                      class="">
                                      #include "freertos/queue.h"<br
                                      class="">
                                      #include "ovms_log.h"<br class="">
                                      #include "ovms_events.h"<br
                                      class="">
                                     @@ -153,6 +155,11 @@ void
                                    OvmsSSH::NetManInit(std::string
                                    event, void* data)<br class="">
                                        // Only initialise server for
                                    WIFI connections<br class="">
                                        if
                                    (!MyNetManager.m_connected_wifi)
                                    return;<br class="">
                                    <br class="">
                                     +  ESP_LOGI(tag, "Initializing
                                    SNTP");<br class="">
                                     +
                                     sntp_setoperatingmode(SNTP_OPMODE_POLL);<br
                                      class="">
                                     +  sntp_setservername(0, (char*)"<a
                                      href="http://pool.ntp.org/"
                                      class="" moz-do-not-send="true">pool.ntp.org</a>");<br
                                      class="">
                                     +  sntp_init();<br class="">
                                     +<br class="">
                                        ESP_LOGI(tag, "Launching SSH
                                    Server");<br class="">
                                        int ret = wolfSSH_Init();<br
                                      class="">
                                        if (ret != WS_SUCCESS)<br
                                      class="">
                                    <br class="">
                                     One problem with fitting this into
                                    the time scheme that you have<br
                                      class="">
                                     implemented is that it will be
                                    updating time in the background on<br
                                      class="">
                                     its own.  The other operating mode
                                    is SNTP_OPMODE_LISTENONLY, which<br
                                      class="">
                                     I don't think would be useful.
                                     There are parameters defined in<br
                                      class="">
 components/lwip/include/lwip/apps/sntp/sntp_opts.h that might be<br
                                      class="">
                                     useful to change.  The current
                                    update interval is one hour.<br
                                      class="">
                                    <br class="">
                                    - Another aspect of the SNMP example
                                    program is the use of the<br
                                      class="">
                                     environment variable TZ to control
                                    the local timezone.  Here is the<br
                                      class="">
                                     'date' command I implemented as a
                                    test:<br class="">
                                    <br class="">
                                     void date(int verbosity,
                                    OvmsWriter* writer, OvmsCommand*
                                    cmd, int argc, const char* const*
                                    argv)<br class="">
                                       {<br class="">
                                       time_t now;<br class="">
                                       struct tm timeinfo;<br class="">
                                       char strftime_buf[64];<br
                                      class="">
                                       setenv("TZ",
                                    "PST8PDT,M3.2.0/2,M11.1.0", 1);<br
                                      class="">
                                       tzset();<br class="">
                                       time(&now);<br class="">
                                       localtime_r(&now,
                                    &timeinfo);<br class="">
                                       strftime(strftime_buf,
                                    sizeof(strftime_buf), "%c",
                                    &timeinfo);<br class="">
                                       writer->printf("The current
                                    date/time in Sunnyvale is: %s\n",
                                    strftime_buf);<br class="">
                                       }<br class="">
                                    <br class="">
                                     Perhaps we should have a config
                                    parameter for timezone?<br class="">
                                    <br class="">
                                                       -- Steve<br
                                      class="">
                                    <br class="">
                                    On Sat, 24 Feb 2018, Mark
                                    Webb-Johnson wrote:<br class="">
                                    <br class="">
                                    <blockquote type="cite" class="">I’ve
                                      done a very rough implementation
                                      of this:<br class="">
                                      <br class="">
                                      OVMS > time set 1519486746<br
                                        class="">
                                      Time set (at stratum 15)<br
                                        class="">
                                      <br class="">
                                      OVMS > time status<br class="">
                                      UTC Time:   Sat Feb 24 15:39:09
                                      2018<br class="">
                                      Local Time: Sat Feb 24 15:39:09
                                      2018<br class="">
                                      Provider:   time<br class="">
                                      <br class="">
                                      PROVIDER             STRATUM
                                       UPDATE TIME<br class="">
                                      *time                     15
                                            4 Sat Feb 24 15:39:10 2018<br
                                        class="">
                                      <br class="">
                                      OVMS > time status<br class="">
                                      UTC Time:   Sat Feb 24 15:39:14
                                      2018<br class="">
                                      Local Time: Sat Feb 24 15:39:14
                                      2018<br class="">
                                      Provider:   time<br class="">
                                      <br class="">
                                      PROVIDER             STRATUM
                                       UPDATE TIME<br class="">
                                      *time                     15
                                            9 Sat Feb 24 15:39:15 2018<br
                                        class="">
                                      <br class="">
                                      I’ll work on it some more
                                      tomorrow. As it is, components can
                                      now call MyTime.Set(…) to feed
                                      their opinion of time into the
                                      system.<br class="">
                                      <br class="">
                                      Regards, Mark.<br class="">
                                      <br class="">
                                      <blockquote type="cite" class="">On
                                        24 Feb 2018, at 10:23 PM, Mark
                                        Webb-Johnson <<a
                                          href="mailto:mark@webb-johnson.net"
                                          class=""
                                          moz-do-not-send="true">mark@webb-johnson.net</a>>
                                        wrote:<br class="">
                                        <br class="">
                                        I forgot about vehicles. Tesla
                                        Roadster is the same.<br
                                          class="">
                                        <br class="">
                                        I’ll write an ovms_time
                                        component now. Then, we can all
                                        submit time to it appropriately.<br
                                          class="">
                                        <br class="">
                                        class OvmsTime<br class="">
                                         {<br class="">
                                         public:<br class="">
                                           OvmsTime();<br class="">
                                           ~OvmsTime();<br class="">
                                        <br class="">
                                         public:<br class="">
                                           void Set(char* provider, int
                                        stratum, bool trusted, time_t
                                        time);<br class="">
                                         };<br class="">
                                        <br class="">
                                        extern OvmsTime MyTime;<br
                                          class="">
                                        <br class="">
                                        Just follow the NTP stratum
                                        approach (distance from a
                                        zero-delay device). Trusted is a
                                        separate indication that just
                                        sets stratum level to 16. The
                                        provider is simply the logging
                                        TAG.<br class="">
                                        <br class="">
                                        Internal implementation is like
                                        NTP. We track the last times
                                        from all providers, and pick the
                                        one with the lowest stratum that
                                        has reported within a reasonable
                                        time.<br class="">
                                        <br class="">
                                        We can add the boot-time
                                        save/restore later (once Michael
                                        has done that code for safe
                                        boot, etc).<br class="">
                                        <br class="">
                                        Regards, Mark.<br class="">
                                        <br class="">
                                        <blockquote type="cite" class="">On
                                          24 Feb 2018, at 9:19 PM, Geir
                                          Øyvind Vælidalo <<a
                                            href="mailto:geir@validalo.net"
                                            class=""
                                            moz-do-not-send="true">geir@validalo.net</a>
                                          <<a
                                            href="mailto:geir@validalo.net"
                                            class=""
                                            moz-do-not-send="true">mailto:geir@validalo.net</a>>>
                                          wrote:<br class="">
                                          <br class="">
                                          Sounds like a plan. I can get
                                          time from the car too, but the
                                          resolution is several seconds,
                                          so I think we need to have
                                          some sort of priority here.
                                          Maybe SNTP first, then GPS,
                                          cellular and finally “car”?<br
                                            class="">
                                          <br class="">
                                          Geir<br class="">
                                          <br class="">
                                          Sendt fra min iPhone<br
                                            class="">
                                          <br class="">
                                          <blockquote type="cite"
                                            class="">24. feb. 2018 kl.
                                            04:36 skrev Mark
                                            Webb-Johnson <<a
                                              href="mailto:mark@webb-johnson.net"
                                              class=""
                                              moz-do-not-send="true">mark@webb-johnson.net</a>
                                            <<a
                                              href="mailto:mark@webb-johnson.net"
                                              class=""
                                              moz-do-not-send="true">mailto:mark@webb-johnson.net</a>>>:<br
                                              class="">
                                            <br class="">
                                            I don’t think so.<br
                                              class="">
                                            <br class="">
                                            There are various sources
                                            for date/time. GPS.
                                            Cellular. SNTP. Need to
                                            ensure that they are not all
                                            fighting.<br class="">
                                            <br class="">
                                            Another module to do this?
                                            Have components tell it
                                            their opinion of the time,
                                            then it centrally decides
                                            and updates system clock if
                                            necessary<br class="">
                                            <br class="">
                                            Also store last clock in RTC
                                            ram so during a crash/reboot
                                            it can recover the last know
                                            time?<br class="">
                                            <br class="">
                                            Regards, Mark<br class="">
                                            <br class="">
                                            <blockquote type="cite"
                                              class="">On 24 Feb 2018,
                                              at 9:44 AM, Stephen Casner
                                              <<a
                                                href="mailto:casner@acm.org"
                                                class=""
                                                moz-do-not-send="true">casner@acm.org</a>
                                              <<a
                                                href="mailto:casner@acm.org"
                                                class=""
                                                moz-do-not-send="true">mailto:casner@acm.org</a>>>
                                              wrote:<br class="">
                                              <br class="">
                                              Does the sytem date get
                                              set anywhere (presumably
                                              from GPS)?<br class="">
                                              <br class="">
                                              This question occurred to
                                              me as I'm working on a
                                              side project using<br
                                                class="">
                                              the DEVKIT-C module which
                                              won't have access to GPS
                                              so I added the code<br
                                                class="">
                                              to set the data using
                                              SNTP.<br class="">
                                              <br class="">
                                                    -- Steve<br class="">
_______________________________________________<br class="">
                                              OvmsDev mailing list<br
                                                class="">
                                              <a
                                                href="mailto:OvmsDev@lists.teslaclub.hk"
                                                class=""
                                                moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
                                              <<a
                                                href="mailto:OvmsDev@lists.teslaclub.hk"
                                                class=""
                                                moz-do-not-send="true">mailto:OvmsDev@lists.teslaclub.hk</a>><br
                                                class="">
                                              <a
                                                href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                                                class=""
                                                moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                                                class="">
                                            </blockquote>
                                            <br class="">
_______________________________________________<br class="">
                                            OvmsDev mailing list<br
                                              class="">
                                            <a
                                              href="mailto:OvmsDev@lists.teslaclub.hk"
                                              class=""
                                              moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
                                            <<a
                                              href="mailto:OvmsDev@lists.teslaclub.hk"
                                              class=""
                                              moz-do-not-send="true">mailto:OvmsDev@lists.teslaclub.hk</a>><br
                                              class="">
                                            <a
                                              href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                                              class=""
                                              moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                                              class="">
                                          </blockquote>
                                          <br class="">
_______________________________________________<br class="">
                                          OvmsDev mailing list<br
                                            class="">
                                          <a
                                            href="mailto:OvmsDev@lists.teslaclub.hk"
                                            class=""
                                            moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
                                          <<a
                                            href="mailto:OvmsDev@lists.teslaclub.hk"
                                            class=""
                                            moz-do-not-send="true">mailto:OvmsDev@lists.teslaclub.hk</a>><br
                                            class="">
                                          <a
                                            href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                                            class=""
                                            moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                                            class="">
                                        </blockquote>
                                        <br class="">
_______________________________________________<br class="">
                                        OvmsDev mailing list<br class="">
                                        <a
                                          href="mailto:OvmsDev@lists.teslaclub.hk"
                                          class=""
                                          moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
                                          class="">
                                        <a
                                          href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                                          class=""
                                          moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                                          class="">
                                      </blockquote>
                                      <br class="">
                                    </blockquote>
_______________________________________________<br class="">
                                    OvmsDev mailing list<br class="">
                                    <a
                                      href="mailto:OvmsDev@lists.teslaclub.hk"
                                      class="" moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
                                      class="">
                                    <a
                                      href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                                      class="" moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                                      class="">
                                  </div>
                                </div>
                              </blockquote>
                            </div>
                            <br class="">
                          </div>
                        </div>
                        _______________________________________________<br
                          class="">
                        OvmsDev mailing list<br class="">
                        <a href="mailto:OvmsDev@lists.teslaclub.hk"
                          class="" moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
                          class="">
                        <a class="moz-txt-link-freetext"
                          href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev"
                          moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                          class="">
                      </div>
                    </blockquote>
                  </div>
                  <br class="">
                  <br class="">
                  <fieldset class="mimeAttachmentHeader"></fieldset>
                  <br class="">
                  <pre class="" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk" moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" moz-do-not-send="true">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
                </blockquote>
                <br class="">
                <pre class="moz-signature" cols="160">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
              </div>
              _______________________________________________<br
                class="">
              OvmsDev mailing list<br class="">
              <a href="mailto:OvmsDev@lists.teslaclub.hk" class=""
                moz-do-not-send="true">OvmsDev@lists.teslaclub.hk</a><br
                class="">
              <a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br
                class="">
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="160">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
</pre>
  </body>
</html>