Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 6 months ago.
Cannot get time-example by Simon Ford to work
I directly imported and the value for "seconds since January 1, 1970" printed is always -1.
I have the standard mbed NXP LPC1768 and am using standard mbed development system.
This is the code:
time-example
#include "mbed.h" int main() { while(1) { time_t seconds = time(NULL); printf("Seconds since January 1, 1970: %d\n", seconds); wait(1); } }
1 Answer
10 years, 6 months ago.
According to the example and previous answers you need to insert a call to set_time to initialize and start the clock.
See http://mbed.org/forum/mbed/topic/344/