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.
11 years, 5 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
11 years, 5 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?
11 years, 5 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!