GithubHelp home page GithubHelp logo

compileTime() wrong TZ about eztime HOT 5 CLOSED

ropg avatar ropg commented on July 30, 2024
compileTime() wrong TZ

from eztime.

Comments (5)

ropg avatar ropg commented on July 30, 2024 1

Ah, in that case, try dateTime(compileTime() - ( yourTZ.getOffset() * 60 ) ), that might correct compileTime expressed in the time of a timezone.

from eztime.

ropg avatar ropg commented on July 30, 2024

Compile time is not stored with a timezone, so ezTime cannot know. So it assumes that compileTime is UTC. Can you try MyTz.setTime(compileTime()) and then just dateTime()?

from eztime.

mike-s123 avatar mike-s123 commented on July 30, 2024

Thanks, that works to properly display the compile time, but it's not clear how to get back to the correct time after...

Timezone myTz;
myTz.setPosix("EST5EDT,M3.2.0,M11.1.0");
 { time_t timeHold;
   unsigned long milliHold;
   Timezone UTC;
   if ( queryNTP("192.168.168.1", timeHold, milliHold)) { 
     myTz.setTime(compileTime());
   } 
   response_message = dateTime(RFC850);
   UTC.setTime(timeHold);
 }

so far, so good. But since setTime only takes full seconds, each pass could cause up to a 1 second error when restoring the proper time.

I settled on just using
dateTime(compileTime(),"l, d-M-y G:i:s ~U~T~C"));
, which I think is still going to bounce around by an hour with summertime changes.

from eztime.

ropg avatar ropg commented on July 30, 2024

I have no idea what you're trying to do there. If you have an NTP server, then why on earth would you use compileTime? compileTime, in my view, is not really useful for more than impressing your friends if you have no internet and want to show an Arduino displaying something like the proper time, it is nothing more than the static time the binary was compiled, after all.

from eztime.

mike-s123 avatar mike-s123 commented on July 30, 2024

I'm using this on an ESP8266 based project. On an informational web page, we show info about the state, sketch size, free heap, code version, etc. I added compileTime to that, so I'm using it for what it actually is (or should be) instead of DATE and TIME, where I have no control over format.

from eztime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.