Giter Site home page Giter Site logo

Comments (16)

bxparks avatar bxparks commented on September 20, 2024

Hi, When most people ask about GPS module, they are thinking about using the GPS module as a source of accurate atomic clock. This would be the equivalent to using NTP (network time protocol) or a battery powered RTC (real-time clock) module, which AceTime supports. But currently, AceTime does not support GPS as a clock source. I think it would relatively easy to add --- probably just an adapter class in src/ace_time/hw pointing to the relevant GPS library --- but I don't own any GPS hardware right now, and I haven't had the time to look into this.

What you are asking for is slightly different and interesting. You want to extract the (lat, lon) location from the GPS, then consult a database to convert the coordinates to a timezone, then use AceTime to calculate the local time. Unfortunately, the AceTime library does not provide this database. However, if you were able to find such a database or build one yourself, to extract the local timezone, then AceTime will do everything else for you.

It seems to me that such a database must already exist somewhere, but I haven't done any research on this, and I am not sure if such a library has been created for the Arduino platform. If you decide to build something like that yourself, I may even be interested in helping out, because it sounds like an interesting problem, and it would compliment the AceTime library... if I ever get around adding support for a GPS module.

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

I agree the adding of GPS as a clock source is fairly easy. The big challenge is the geographic comparison of the GPS coords and the Timezone boundaries. Appreciate the feedback!

Saw this link and got the impression the geographic comparison was possible. Thoughts?
https://www.reddit.com/r/arduino/comments/cq1wh6/acetime_library_date_time_clock_and_tz_database/

from acetime.

bxparks avatar bxparks commented on September 20, 2024

Another random thought:

I would guess that GPS modules in the hobbyist market are far inferior to the GPS modules inside a modern smartphone. The smartphone combines information from cell tower triangulation, WiFi SSIDs, and GPS signals, to get the most accurate geo-coordinates. And we know that it converts that into timezone, because the phone is usually set to "Automatically set timezone from network". For your application, I wonder if it's possible to obtain the local timezone information over bluetooth from your smartphone? If that's possible, then you can feed the timezone into AceTime, and it will take over from there.

Caveat: I don't have any experience with the bluetooth stack on Arduinos (e.g. ESP32), so I don't know how well the bluetooth stack works on Arduinos.

from acetime.

bxparks avatar bxparks commented on September 20, 2024

Not sure what you mean by "geographic comparison" in the reddit post that I wrote. I didn't mention GPS coordinates... Just timezones from the TZ database.

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

I'm looking to make the design fully standalone for the calculation of local time - no wifi/bt connection to external devices. Make it purely a geographic comparison of GPS coords to a timezone boundary database. Am ok if the resolution was only accurate to a few NMs... maybe that would reduce the database size by not requiring extensive boundary data. I do want something more than 1hr/15degrees though!

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

Not sure what you mean by "geographic comparison" in the reddit post that I wrote. I didn't mention GPS coordinates... Just timezones from the TZ database.

A bit of assumption on my part, but does the TZ database provide the geographic boundaries for each TimeZone? If so, then in theory the GPS coords could be compared to these boundaries to determine which timezone is for the location.

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

Just found this effort: https://github.com/evansiroky/timezone-boundary-builder Will continue researching.

from acetime.

bxparks avatar bxparks commented on September 20, 2024

No the TZ database is a listing of rules. The physical boundaries are not defined by them.
With a big enough database, and enough resources to keep it up to date, I'm sure it's technically possible. But it seems like a lot of work. This map (https://en.wikipedia.org/wiki/Time_zone#/media/File:World_Time_Zones_Map.png) shows the high level timezone boundaries. But we also know that small cities (e.g. in Indiana) and regions (e.g. Native American reservations, war-conflict regions) inside those big boundaries can follow different sets of rules.

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

Ah, so unlikely a single design for world use would be feasible. However, wonder if a design for just the U.S. would be reasonably possible? ...not requiring too large an onboard database?

from acetime.

bxparks avatar bxparks commented on September 20, 2024

It kinda depends on how much accuracy you need, doesn't it. If your timezone regions are defined by only a handful large, rectangular lat/lon blocks, that's a small database. But it would often be wrong when crossing state boundaries. If you want more accuracy, you need large databases and more complicated code. Sounds like an interesting project, have fun!

from acetime.

doanerock avatar doanerock commented on September 20, 2024

I personally have no interest in my clock trying to determine what time zone it is in. I do have a BIG interest in using AceTime to use GPS to set the time with no internet access. Pease keep in mind that there is a packet that contains a GPS-to-GNSS time offset that must be accounted for.
@bxparks Would you like me to send you a GPS break out board? They are pretty neat and often work inside.

from acetime.

bxparks avatar bxparks commented on September 20, 2024

@doanerock: Hmm. So let me just clarify that if you are working on a commercial project that needs this GPS feature, you should contact me via email to chat about it, because I'm not going to do this work for free. If this is for personal use, I'm sorry that I won't have time to do this work. It's an interesting feature that I would love to support, but realistically I have too many other projects in my queue, and this feature is not something I need in the next 6-12 months. You are of course encouraged to write this code yourself, and offer it as your own Arduino library that extends AceTime. (I would be hesitant to accept that code into AceTime, because that would impose future maintenance burden on me, especially for code that I cannot test myself.) So, thanks for the offer, but probably not in the next 6-12 months. I'm not completely ruling it out, because I hope to look into this feature at some point.

from acetime.

doanerock avatar doanerock commented on September 20, 2024

@bxparks Sorry I did not mean to offend. I saw that previously in the thread you mentioned you did not have any GPS hardware so I thought since am not the best coder but I do have a GPS breakout board handy so I should offer it since that is what I can do to help. I did not mean to put unnecessary pressure on you. I just wanted to put in a vote for the feature and lend assistance.

from acetime.

Bwanna avatar Bwanna commented on September 20, 2024

from acetime.

bxparks avatar bxparks commented on September 20, 2024

@doanerock : No worries, no offense taken. Just wanted to be straightforward about how I prioritize my time and effort, and what my schedule looks like for the next 6-12 months.

@Bwanna : It sounds like you are not familiar with other timezone libraries (e.g. Python pytz, dateutils; Java Time, Joda Time, Noda Time, etc). If you are familiar with those, then the AceTime README.md and the sample code should make it pretty clear about what the library does. If you are not familiar with timezone at all, then yes, it can all be very confusing. I have a whole bunch of links and references in my README.md and USER_GUIDE.md files. Hopefully, some of those will help you. Good luck!

from acetime.

bxparks avatar bxparks commented on September 20, 2024

I'm going to close this ticket, since I don't think there is anything actionable for me to do. Please reopen if you have further questions.

from acetime.

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.