Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 21022

How to get current time

$
0
0

<edit>

I have verified that the Edison board has the correct time.

Does anyone know why the year, month and day methods of Time.h return dates in the 1970's?

I would think they would read the time from the board and return the current datetime.

<endedit?

 

 

 

 

I have verified by using putty to check the time on the board,  It is getting set by ntp and shows 11/08/2014.

 

When I use time.h in my sketch this returns 1970

 

char cTime[22];

Serial.println("2");

sprintf(cTime, "%04d.%02d.%02d.%02d:%02d:%02d", year(), month(), day(), hour(), minute(), second());

 

19700101:000759


Viewing all articles
Browse latest Browse all 21022


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>