-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timezone #42
Comments
No one got any views ?? |
I see no reason why it won't work, have you tried it? If 3600 is one hour for the ntp service then adjusting the offset to (3600+1800) 5400 must work. And if the increment is currently 1 adjusting the code to 0.5 should be straightforward and at worst the time zone variable is an int that could be changed to a float. |
Thank you so much for getting back. I tried it, still can't get the 0.3 mins working. The time is either 30 mins ahead or 30 mins behind |
It’s because the hour variable is a integer and so it’s being rounded up or down to the nearest hour, that variable type would need to be changed throughout the programme to enable 0.5 hours to be held and hence displayed correctly. |
I had a look at the source code, only in 12-hour mode is the hours an integer, line 318. What did you use for configTime(UTC_OFFSET * 3600, 0, NTP_SERVERS); UTC_OFFSET is default 1, try And set the clock to 24-hour mode. |
@soubs I was thinking about this, and perhaps scaling the 24 hours in a day to 240 segments (so 10x as many) is a way forward -- it will still fit in an 8 bit CHAR, and permit using an offset of 5 rather than .5 (a FLOAT) This would be at the expense of more code to do the scaling, of course |
In settings.h on line 54 #define UTC_OFFSET + 1 change to #define UTC_OFFSET + 5.5 for India |
@G6EJD Thank you so much for your advice, it worked. Below is the code that I used in the setting.h as you mentioned. // Settings for India Can't take the DST rules out as there are dependencies so added the same rule for both the changes. Also, the 12 hr seems to be working. I will use it for a couple of days a see how it goes. Will report back in case of any issues |
Those changes will have solved the India Time Zone and no code changes which is good. You should have no further problems now. Glad it's worked out. |
I think I have jumped the gun here .. All seems to be working fine, however the time reverts to 12:00:00 after the first update and not updating the time or weather. |
This is most likely due to your internet connection, or choice of time server, perhaps use http://www.pool.ntp.org/zone/in to use a more localised server. 55 struct dstRule StartRule = {"CEST", Last, Sun, Mar, 1, 3600}; // Central India Summer Time = UTC/GMT +2 hours Does your DST move by only 30-mins? You have used 1800=30-mins? Time server: should be: #define NTP_SERVERS "0.in.pool.ntp.org", "1.in.pool.ntp.org", "2.in.pool.ntp.org" OR: #define NTP_SERVERS "0.asia.pool.ntp.org", "1.asia.pool.ntp.org", "2.asia.pool.ntp.org" |
I have already made one for myself in Sydney which is +10 UTC and it works flawless. I have added 1800 to adjust the time to IST. I have updated the NTP servers as you mentioned however still getting the same result. |
But does time (mins) move by 30-mins ? My npt clock increments time supplied to the config time statement in 30-min steps and that works just fine. Daniels software then displays time from the server and there is no manipulation of the variables try putting some diagnostic print statements around the config time function or monitoring the serial port to see if there are any runtime errors. |
Alas, it seems there is no answer to this problem as I have now discovered the time library ignores the DST parameters: So the time library will accept non-integer parameters but does not act on them, effectively only using 5 for a parsed 5.5 offset and furthermore it completely ignores the DST parameter! There is forum discussion and folks have done what I have and produced a small test programme to confirm 'configureTime' is not working as expected. See here: esp8266/Arduino#2505 |
Hi there, I think there is some hope.. I think I had a bit of issue with my wifi , after changing it , it's running for 3 hrs at the moment and it's updating. Fingers crossed.. will update after running it for a few days now. |
Good to hear, but the configtime library function can’t handle 30-min offsets which is a surprise to me as I trialled it like others to confirm the function is defective so the best you will get is 5 or 6 hours offset. Clearly the fact that some parts of the world that have 1/2 hour offset increments was not considered during its build. I have not tried other time libraries as these may well have solved this issue. |
Hi @G6EJD , Update, the timezone seems to be working fine. What I realised is that the code now assumes the time is by default 12:30:00 so it works. But now we got a different problem - Since there is no DST rule in the India timezone it works with the start rule but goes all wrong with the end rule. Any suggestions, we are this close to getting it done !! And I can't seem to ignore the DST rules. #define UTC_OFFSET +5.5 I did think about a way , to start the DST on a day and end it the next day , so the clock will be usable 364 days in a year, not ideal , but may work as a solution. |
How are you moving time forward? The NTP and time library use UNIX time so you’d need to add an offset to ordinal time to do it properly. |
Apologies for the late reply, have been travelling for work. I can get the code to work , but the dst rule ruins it all and I can't fix that. Any help will be most appreciated |
The library being used for DST does not support 30-min increments, you could ask the author to modify it, really it's an issue on Github because there are countries in the world like yours that have 30-mins offsets. It would have been better if the library had been designed with that constrained at the onset. |
Hello , Code fix that I used: settings.h: the main code file: To me logically it should work. Any insights, most appreciated. Thanks |
If your using a whole number DST offset it should work OK but using 0.5 hour increments don’t. Check out the DST library details as that’s what determines success or not. |
I see little benefit of keeping this open any longer. Everything there is to be said has been said. The relevant external issues are as follows: |
Hey! Thank you |
Hi There,
Just wanting to find out if India timezone can work on this device. That is UTC +5.30 hrs. I did a bit research across posts, it seems like the +30 mins is not supported by the library. Has there been any update to this.
This is a really interesting project and would like to gift the project to a friend from India.
Thanks
The text was updated successfully, but these errors were encountered: