You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • clk comes from here, which is called during initialization - it's just a clock object set to the current time.

    I was getting this behavior with the latest cutting edge build - forgot to mention this in original post.

    function getDate() {
      console.log("getDate called");
      var date="";
      require("http").get(dateurl, function(res) {
        res.on('data',function (data) {date+=data;});
        res.on('close',function() {console.log("onClose called");clk=new Clock(date);});
      });
      //delete getDate;
    }
    

    The dateurl is a url of a page that returns a string containing the current date (modified to correct for the time zone issue), and I believe that is working correctly, since I have the same code using the same URL on my desk light, where it gets the time successfully (Espruino Board 1v3 with v80 (ie, post v80 release, new numbering system) bigram).

    The reason I use safeGetTime() is that if the initial request to get the date fails, I don't want every call to getMirrorString() to fail, since it could still be recording information, and if it gets back -1 for the current time, and then subtracts a bunch from it, it's still okay.

    The code being run is https://github.com/SpenceKonde/AzzyProje­cts/edit/master/VoiceController.js - except I forgot to click sync last night so the version in github is from before I fixed the syntax errors. x_x

About

Avatar for DrAzzy @DrAzzy started