• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

summer winter time micropython vs arduino

Q&A Forum › Category: Other › summer winter time micropython vs arduino
0 Vote Up Vote Down
Eric Roest asked 4 years ago

I found the module utime on the internet.
if you import utime, you can get the actual time and date with the command utime.localtime()
In the Netherlands it’s now summertime and the time is now correct with the command localtime(), but wil give this command also the right time in the winter?
I couldn’t find anything on the internet for arduino that give the right time summer and winter. Is this an advantage of micropython?

Question Tags: summer winter time
7 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Eric.
I’m not sure I understood your question. 
I think the localtime() should give the correct winter and summer time, but I’m not sure.
As for the Arduino, we have these guides about time:

  • https://randomnerdtutorials.com/epoch-unix-time-esp32-arduino/
  • https://randomnerdtutorials.com/esp32-date-time-ntp-client-server-arduino/

There are functions to adjust daylight offset as well as time zone in this last tutorial.
I hope this helps.
Regards,
Sara
 

0 Vote Up Vote Down
Eric Roest answered 4 years ago

Sara, i couldn’t get the codes running on a esp8266, but i found on the internet this example, based on your website.
https://opencircuit.nl/Blog/WiFi-klok-met-de-ESP32-OLED/Code
in the file config.h is a rule: const int daylightOffset_sec = 0; // Daylight savings 0|3600
Here you have to change manually the summer and wintertime. That’s not what i want and what MicroPyhton does, that gives automatically the correct time.
 

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
I’m sorry. I thought you were using an ESP32. For the ESP8266, we have these guides (similar to the previous ones – not automatic correct date and time, you need to set the parameters or do some calculations):

  • https://randomnerdtutorials.com/epoch-unix-time-esp8266-nodemcu-arduino/
  • https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/

Regards,
Sara

0 Vote Up Vote Down
Eric Roest answered 4 years ago

Thanks Sara, that’s what i needed to know.
So you have to change your sketch twice a year with arduino and you don’t have change it with MicroPython

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

There is an Arduino library that can do it for you.

0 Vote Up Vote Down
Eric Roest answered 4 years ago

Oh wow, that is just what i needed.
Many thanks Steve!!!!
I it works is a mystery to me, but who cares.

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

That’s exactly how I treat libraries. It works and I don’t really care how it works. 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.