8 years, 2 months ago.

Discrepancy between PC system time and mbed time?

Good morning,

I have been attempting to set the mbed system time, using the value returned by a time(NULL) statement on a generic (GNU/VS) compiler. However, taking the value returned from that statement and using set_time(<value_returned>) on the mbed sets the time to be exactly four hours ahead. I have tried this on both a GNU and VS compiler, and formatted the time to verify that the time returned is accurate; therefore, why is the mbed interpreting this time differently?

Thank you for your time.

2 Answers

8 years, 2 months ago.

First of all, you really should feel bad about that pun ;).

Next the question: Which timezone are you in? Can it be difference between GMT and your timezone?

Accepted Answer
8 years, 2 months ago.

Bingo, that's the discrepancy. On GNU I was using localtime(), whereas the mbed called asctime(). I am in Eastern US, which is 4 hours behind GMT. Thank you!