Convert utc time 24 hr clock3/6/2024 ![]() I put a little bit into the setup section with a hard-coded unix timestamp I gradually added more pieces of my full code. In the meanwhile, I have tried to create a minimal piece of code to reproduce the problem. Removing the + 11 did not resolve my problem, and I didn't expect it to. This I included because the updated rtc time appeared to be off by about 11 seconds as compared to the time on my computer, which I take as a reference. So basically my question is: how do I correctly feed the time received from the rtc to the toLocal() function of the Timezone library to obtain the correct local time? So I guess I might provide a wrong data type (though I receive no error). 1585684200, provided as unsigned long), I get an unexpected result, too. If I replace nowUTC in the toLocal() function by a hard-coded DST timestamp (e.g. Just by re-uploading the code to my Arduino - sometimes the results are as expected but most of the time they are not. However, what is even more weird is that sometimes I get the expected result. What I obtain is nowUTC and nowLocal being equal, and utcIsDST() returning 0. However, that doesn't seem to happen most of the time. Now, what I would expect is that nowUTC will be adjusted so that it gains an hour because currently we have British Summer Time. Serial.println("Is nowUTC DST?: " + String(UK.utcIsDST(nowUTC))) Getting time from NTP server beforehand Timezone rules for United Kingdom (London, Belfast) ![]() ![]() So here are the corresponding code snippets: time_t UTCtime I want to use the Timezone library for that.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |