9 years, 6 months ago.

gmtime function

In CyaSSL library there is code to validateDate (in asn.c) which uses gmtime to get current time. I get strange values back in the tm structure. Guess this is because the board (mbed board) does not have any internal clock and gmtime does not use NTP behind the scenes? What is the right way (if there is one) to get current time without doing NTP?

1 Answer

9 years, 6 months ago.

If you are using your LPC1768 mbed, it does have an internal clock: http://developer.mbed.org/handbook/Time, and that one is used by gmtime. However you do need to put it on the correct time. One option is to use NTP (if you have SSL, then I would expect you can also do NTP?), other options are setting it manual (either at compile time, or with user buttons for example, but there are also other options), using a radio clock module, gps, etc.

Accepted Answer