Giter Club home page Giter Club logo

Comments (7)

awickert avatar awickert commented on June 4, 2024

Sounds like a good idea! Indeed, I have thought about doing that too, but I haven't. It would just take writing some code to convert the epoch to the date/time parameters for the registers.

The reason that I have not yet done this is because I have written code that takes the computer time and directly sends it to the logger, thus negating the need for any human input. This link works with our older-model data loggers, but should be able to be ported to work with more generic Arduino devices: https://github.com/NorthernWidget/ALogTalk.

from ds3231.

hasenradball avatar hasenradball commented on June 4, 2024

I found this for the Arduino nano 33 iot. There you could set the time by giving the epoch.

It s a nice solution, but the RTC of the nano is a really bad rtc compared to the DS3231.

One point would be setting the correct local time.

My first proposal would be starting with

setEpoch(time_t epoch)

and epoch in the first approach is the already corrected time value for the local time...

I can test if you want!

best regards

Frank

from ds3231.

awickert avatar awickert commented on June 4, 2024

If you would like to test some code and make a PR, please do! I do not have time or plans to make any significant edits here in the foreseeable future.

from ds3231.

hasenradball avatar hasenradball commented on June 4, 2024

Hi,
I have one question....
I found the following constuctor:

DateTime::DateTime (uint32_t t) {
  t -= SECONDS_FROM_1970_TO_2000;    // bring to 2000 timestamp from 1970

    ss = t % 60;
    t /= 60;
    mm = t % 60;
    t /= 60;
    hh = t % 24;
    uint16_t days = t / 24;
    uint8_t leap;
    for (yOff = 0; ; ++yOff) {
        leap = isleapYear(yOff);
        if (days < 365 + leap)
            break;
        days -= 365 + leap;
    }
    for (m = 1; ; ++m) {
        uint8_t daysPerMonth = pgm_read_byte(daysInMonth + m - 1);
        if (leap && m == 2)
            ++daysPerMonth;
        if (days < daysPerMonth)
            break;
        days -= daysPerMonth;
    }
    d = days + 1;
}

It seems you can gibe the epoch, right?
But the RTC is then not feed with the values?
Can you give some informations?

Frank

from ds3231.

hasenradball avatar hasenradball commented on June 4, 2024

No I think it is not the RTC class...

from ds3231.

awickert avatar awickert commented on June 4, 2024

You are correct: this is in a separate class.

from ds3231.

awickert avatar awickert commented on June 4, 2024

Thank you for the PR #38. Looks like you tested it too and it works, so I'm closing this.

from ds3231.

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.