Time Sync with external server
-
- Posts: 26
- Joined: Mon Jul 18, 2011 8:06 pm
- Location: Dublin Ca
- Contact:
Re: Time Sync with external server
Ok so i had this long post going untill i figured out that the date is a moving date for DST and every year it is changing.. what is needed is a world database that could be used to tell if or when you change then a code could be sent to the server to calculate based on the est rules your server goes by..
Oh boy this is a pain....
like this http://twiki.org/cgi-bin/xtra/tzdatepick.html#GMT
Oh boy this is a pain....
like this http://twiki.org/cgi-bin/xtra/tzdatepick.html#GMT
http://forum.reefangel.com/status/banner_3.aspx?id=Paul Viscovich&t=-7
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
-
- Posts: 26
- Joined: Mon Jul 18, 2011 8:06 pm
- Location: Dublin Ca
- Contact:
Re: Time Sync with external server
Ok new Idea
http://api.geonames.org/timezone?lat=37 ... rname=demo
can you send a string like this from the wifi and then read the responce
or maybe you can get this api for your site
then all you would need to do is pass the lat and lng to it and it would do the rest
you can use just about anything these days to het the long and lat of your location
http://www.geonames.org/export/web-serv ... l#timezone
Timezone
Webservice Type : REST
Url : api.geonames.org/timezone?
Parameters : lat,lng, radius (buffer in km for closest timezone in coastal areas), date (date for sunrise/sunset);
Result : the timezone at the lat/lng with gmt offset (1. January) and dst offset (1. July)
Example http://api.geonames.org/timezone?lat=47 ... rname=demo
This service is also available in JSON format : http://api.geonames.org/timezoneJSON?la ... rname=demo
Element:
timezoneId: name of the timezone (according to olson), this information is sufficient to work with the timezone and defines DST rules, consult the documentation of your development environment.
time: the local current time
rawOffset: the amount of time in hours to add to UTC to get standard time in this time zone. Because this value is not affected by daylight saving time, it is called raw offset.
gmtOffset: offset to GMT at 1. January (deprecated)
dstOffset: offset to GMT at 1. July (deprecated)
<?xml version="1.0" encoding="UTF-8"?>
-<geonames>
-<timezone>
<countryCode>US</countryCode>
<countryName>United States</countryName>
<lat>37.71</lat>
<lng>-121.9</lng>
<timezoneId>America/Los_Angeles</timezoneId>
<dstOffset>-7.0</dstOffset>
<gmtOffset>-8.0</gmtOffset>
<rawOffset>-8.0</rawOffset>
<time>2011-07-19 00:01</time>
<sunrise>2011-07-19 06:00</sunrise>
<sunset>2011-07-19 20:26</sunset>
</timezone>
</geonames>
http://api.geonames.org/timezone?lat=37 ... rname=demo
can you send a string like this from the wifi and then read the responce
or maybe you can get this api for your site
then all you would need to do is pass the lat and lng to it and it would do the rest
you can use just about anything these days to het the long and lat of your location
http://www.geonames.org/export/web-serv ... l#timezone
Timezone
Webservice Type : REST
Url : api.geonames.org/timezone?
Parameters : lat,lng, radius (buffer in km for closest timezone in coastal areas), date (date for sunrise/sunset);
Result : the timezone at the lat/lng with gmt offset (1. January) and dst offset (1. July)
Example http://api.geonames.org/timezone?lat=47 ... rname=demo
This service is also available in JSON format : http://api.geonames.org/timezoneJSON?la ... rname=demo
Element:
timezoneId: name of the timezone (according to olson), this information is sufficient to work with the timezone and defines DST rules, consult the documentation of your development environment.
time: the local current time
rawOffset: the amount of time in hours to add to UTC to get standard time in this time zone. Because this value is not affected by daylight saving time, it is called raw offset.
gmtOffset: offset to GMT at 1. January (deprecated)
dstOffset: offset to GMT at 1. July (deprecated)
<?xml version="1.0" encoding="UTF-8"?>
-<geonames>
-<timezone>
<countryCode>US</countryCode>
<countryName>United States</countryName>
<lat>37.71</lat>
<lng>-121.9</lng>
<timezoneId>America/Los_Angeles</timezoneId>
<dstOffset>-7.0</dstOffset>
<gmtOffset>-8.0</gmtOffset>
<rawOffset>-8.0</rawOffset>
<time>2011-07-19 00:01</time>
<sunrise>2011-07-19 06:00</sunrise>
<sunset>2011-07-19 20:26</sunset>
</timezone>
</geonames>
http://forum.reefangel.com/status/banner_3.aspx?id=Paul Viscovich&t=-7
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
-
- Posts: 26
- Joined: Mon Jul 18, 2011 8:06 pm
- Location: Dublin Ca
- Contact:
Re: Time Sync with external server
http://api.geonames.org/timezone?lat=37 ... ablocorals
signed up and made an account that means that i can do 33000 time requests a day..
maybe you could set up a free reefangle account
and the
http://api.geonames.org/timezone?lat=37 ... ablocorals
out put could be read back in
Of cource this also could be done server side if teh users cointroller posts to reefangle and the page there posts the data and collects the data and then send the time info back to the controller
Again i may be off base but it is what i have found sofare with out knowing the limmits it is hard to tell what you can do
signed up and made an account that means that i can do 33000 time requests a day..
maybe you could set up a free reefangle account
and the
http://api.geonames.org/timezone?lat=37 ... ablocorals
out put could be read back in
Of cource this also could be done server side if teh users cointroller posts to reefangle and the page there posts the data and collects the data and then send the time info back to the controller
Again i may be off base but it is what i have found sofare with out knowing the limmits it is hard to tell what you can do
http://forum.reefangel.com/status/banner_3.aspx?id=Paul Viscovich&t=-7
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
-
- Posts: 26
- Joined: Mon Jul 18, 2011 8:06 pm
- Location: Dublin Ca
- Contact:
Re: Time Sync with external server
too bad jess needs both of his controllers or i would be working on this from my end ... I cant go wipe his code to play maybe one of these days i can buy one for dev work...
Ok enough rambling for one night im off to bed...
Ok enough rambling for one night im off to bed...
http://forum.reefangel.com/status/banner_3.aspx?id=Paul Viscovich&t=-7
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
Re: Time Sync with external server
The server can always give me GMT (or if you prefer calling UTC), and also the current time (Eastern Time) with the daylight savings offset that follows the Eastern Time USA daylight savings rules.
But, I actually love that site you refered.
It's got exactly what we need:
http://download.geonames.org/export/dump/timeZones.txt
That XML data also gave me other ideas.
Exact sunset and sunrise hours for a particular area.
So, if one would like to replicate Fiji sunrise and sunset hours, the controller could adjust itself and dim the LED strings according to those hours. Well, this is topic for another thread.
Anyway, I'm going to enter the data into a database and generate an id for each timezone. Then, instead of passing offset to SyncTime function, we pass the id for the timezone to get the correct time adjusted for daylight savings.
Thanks for the research
But, I actually love that site you refered.
It's got exactly what we need:
http://download.geonames.org/export/dump/timeZones.txt
That XML data also gave me other ideas.
Exact sunset and sunrise hours for a particular area.
So, if one would like to replicate Fiji sunrise and sunset hours, the controller could adjust itself and dim the LED strings according to those hours. Well, this is topic for another thread.
Anyway, I'm going to enter the data into a database and generate an id for each timezone. Then, instead of passing offset to SyncTime function, we pass the id for the timezone to get the correct time adjusted for daylight savings.
Thanks for the research
Roberto.
-
- Posts: 26
- Joined: Mon Jul 18, 2011 8:06 pm
- Location: Dublin Ca
- Contact:
Re: Time Sync with external server
i was thinking the same thing about the sunset sun rise it seems like it could be levraged for many things..
http://forum.reefangel.com/status/banner_3.aspx?id=Paul Viscovich&t=-7
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
14 Gallon Bio Cube with INTANK filtration Thanks Diablo Corals
Re: Time Sync with external server
Ok, so the more I try to come up with a solution, the more I come to realize that it is so much easier to just sync with your computer by using the Client 2.2 twice a year when daylight savings changes.
With the new Client 2.2, you can simply sync it with a click of a button and it can be done through USB or wifi.
With the new Client 2.2, you can simply sync it with a click of a button and it can be done through USB or wifi.
Roberto.
Re: Time Sync with external server
yeah, it is pretty simple and easy to do now that we have the web server responding to the date command.
curt
curt
Re: Time Sync with external server
curt, have you enable this on your .16 version ?
Re: Time Sync with external server
No I did not add in the external time sync functionality to my libraries because of how the discussion went. It's simpler to just either set the date manually or update it via the wifi interface.lukeluke wrote:curt, have you enable this on your .16 version ?
I know you do not run Windows (I believe you run Ubuntu linux or some other variant) so you cannot run the client suite. For now, you would have to manually set the date/time yourself via the memory command.
Code: Select all
http://CONTROLLER_IP:2000/dHHMM,MMDD,YY
- HH - hours
- MM - minutes
- , - comma
- MM - month
- DD - day
- , - comma
- YY - year (since 2000)
Set the date to August 8th, 2011 at 9:30am
Code: Select all
http://CONTROLLER_IP:2000/d0930,0808,11
NOTE: Type this in the URL box in your web browser to set the date/time.
curt
Re: Time Sync with external server
ok thanks
Re: Time Sync with external server
curt is possible modify other internal memory parameters trought the browser ?
Re: Time Sync with external server
Yes, it is indeed, but the Real Time Clock (RTC) data is not within the internal memory block.
The RTC chip is the one that holds the time and keeps it up.
The controller also syncs with it periodically.
The RTC chip is the one that holds the time and keeps it up.
The controller also syncs with it periodically.
Roberto.
Re: Time Sync with external server
Yes, you most certainly can. It is slightly more complex in doing this though. You must know the location and what type of value is stored there (byte or integer). These locations are stored inside ReefAngel_Globals.h and whether it is a byte or integer.lukeluke wrote:curt is possible modify other internal memory parameters trought the browser ?
For working with Bytes:
Code: Select all
// Read the memory value
http://CONTROLLER_IP:2000/mbLOC
// LOC is the memory location
// Write the memory value
http://CONTROLLER_IP:2000/mbLOC,VAL
// there must be a comma (,) between LOC and VAL (which is the value)
Code: Select all
// Read the memory value
http://CONTROLLER_IP:2000/miLOC
// LOC is the memory location
// Write the memory value
http://CONTROLLER_IP:2000/miLOC,VAL
// there must be a comma (,) between LOC and VAL (which is the value)
curt