Questions tagged [time]

Use this tag for questions regarding how to get the time on an Arduino, how to create or use clocks with an Arduino, or anything that has time as a substantial factor in it. Also consider using [programming] or other more specific tags.

Use this tag for questions regarding how to get the time on an Arduino, how to create or use clocks with an Arduino, or anything that time would be a substantial part of the problem/question.

Also consider using or other tags specific to your problem.

210 questions
5
votes
1 answer

Shortest time interval that Arduino Uno R3 can read

I am doing a light speed determination experimsmt. Lightspeed is around 3*10^8 m/s. For this, I need to measure time interval between 2 light sensors in nanoseconds, Somewhere about 50ns. Is this possible using the Uno R3? I know the clock is 16MHz…
5
votes
1 answer

Delay function without using a timer

Is there a delay function available that does not use millis() which itself makes use of a timer? Does not need to be hyper-exact.
Thomas S.
  • 566
  • 2
  • 8
  • 20
5
votes
3 answers

Clock drift - is the precision of the crystal the only culprit?

I've a wall clock (sorry, code's a mess, look for updateClockVars) which makes use of the Timezone library (and ultimately Time). Nothing fancy, call millis() every loop; turn to Hrs, Mins, Secs; display on LEDs. The magnitude of the drift I am…
kaay
  • 223
  • 3
  • 9
2
votes
2 answers

How much time does the Arduino need to call a Function or to read a Variable?

How much time does an Arduino Uno or Mega need to only call a function. And how does the time change if this function is inside a Class, for example inside a Library? The same thing for a variable. How much time does a micro-controller need to read…
William Roy
  • 515
  • 3
  • 10
  • 22
2
votes
0 answers

Simplified timezone shapefile suitable for Arduino?

Is there a library or shape file available that allows an Arduino to approximate a timezone based on a latitude/longitude coordinate? There is a timezone shape file available, but it's too detailed and too large. I am hoping someone knows of a…
Ana
  • 480
  • 2
  • 7
  • 13
1
vote
2 answers

How do I execute some code at a certain time without RTC module?

I am building a project when I need my arduino to execute some code at two given hours of the day, for example one at 19:00 and another at 06:00. I know that with a RTC module I can do this easily, however how can I do that without a RTC module? I…
user45695
1
vote
1 answer

How can I handle micros() double rollover?

I know that I can handle a single rollover with subtraction: if (micros() - lastTime > period) { lastTime = micros(); ... } But how it can be handled if this is not true or it is not checked for more than 70 minutes (without using uint64_t)?
Vasil Kalchev
  • 293
  • 1
  • 2
  • 12
1
vote
1 answer

Find a time server for NTP to get the current time (EtherCard library)

There are lots of examples around how to connect with an NTP server, but I do not see how to find such an IP-address. From the examples I conclude I need to find it on for example pool.ntp.org, but I do not even see how to get IP-addresses out of…
PHPirate
  • 117
  • 1
  • 10
1
vote
1 answer

Convert UNIX Timestamp

I have an UNIX Timestamp in my Arduino Sketch and would like to get the day of the week of this timestamp (1-7). How can I convert the timestamp to get the day of the week?
dHjnMju
  • 11
  • 1
  • 2
0
votes
1 answer

`time.h` vs `TimeLib.h` on AVR boards

Why do I get wrong result when using time.h library when using AVR boards, such Nano/Uno/Pro Micro (while when using TimeLib.h). OUTPUT (for given Epoch ): TimeLib: 2022-04-02 16:11:20 time.h: 0152-03-01 16:11:20 CODE: #define CASE 1 #if CASE ==…
guyd
  • 1,033
  • 2
  • 16
  • 51
0
votes
5 answers

Ignore event until x minutes

I have an arduino where I looking for an input event then do something. Unfortunately this input event can occur like 200 times and I only care about the first notification. Since I have a DS1302 timer handy in the circuit already for other purposes…
catkillr
0
votes
2 answers

using millis() for a timer

Basically the user presses a button and cycles thru 3 different modes. Mode 1 the LED is on, mode 2 the LED is off and mode 3 the LED is kept on for a certain amount of time. I'm using the millis() to keep track of the time. the LED in the third…
0
votes
2 answers

Can't store time over 9 hours and 10 minutes

I am making a clock on my Arduino Uno using the time library http://playground.arduino.cc/Code/Time I let the user set a time. Which is then converted to seconds and used in the setTime(s); function. When the value is over 9:10h, the seconds…
-1
votes
1 answer

localtime - executing one after the other- different time_t, but getting same results

When I try to comapre 2 time_t values I get unexplained behavour time_t t = 12345; time_t T = 67890; struct tm *tm = localtime(&t); struct tm *Tm = localtime(&T); char timeStamp[40]; sprintf(timeStamp, "(1) %04d-%02d-%02d %02d:%02d:%02d",…
guyd
  • 1,033
  • 2
  • 16
  • 51
-1
votes
1 answer

`ConfigTime` daylight saving update

I'm using an ESP8266 to get clock NTP sync in this manner: void myIOT2::_startNTP(const int gmtOffset_sec, const int daylightOffset_sec, const char *ntpServer) { configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); //configuring time offset…
guyd
  • 1,033
  • 2
  • 16
  • 51
1
2