0

I have been searching for a library or some functions that can get the time from the device that is used to program the Arduino(laptop, phone whatever). Something like the Time library but that takes the current time. Would I need to have an internet connection for that, or is there any that do it offline too?

Dragos Spiridon
  • 51
  • 1
  • 2
  • 10

2 Answers2

1

Unless you have an atomic clock, you can't get the exact time without an internet connection, GPS, etc.

If you have an ethernet port on your Arduino platform, you probably can use NTP to sync the time from your local network (or directly from NTP server on Internet).

Loïc G.
  • 3,087
  • 3
  • 24
  • 36
  • Thank you for your answer, but I was mostly referring to the time that is displayed on my desktop for example(eg: 5:41/17:41 at this moment) – Dragos Spiridon May 14 '17 at 14:40
0

The Arduino can't tell the PC to give up any information. You would need a program running on the PC that sends the time over the serial port to the Arduino in order to get the time as it appears on the PC.

Delta_G
  • 2,927
  • 2
  • 9
  • 15