This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP432E401Y:时间库问题

Guru**** 2540720 points
Other Parts Discussed in Thread: MSP432E401Y

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/977139/msp432e401y-time-library-problem

器件型号:MSP432E401Y

您好!

我正在使用 MSP432E401Y 控制器并尝试构建时间库函数。

struct tm ltm;
memset (&LTM、0、sizeof (struct tm));

LTM.TM_year = 2022 - eparch_year;//eparch_year = 1970
LTM.TM_mon = 0;
LTM.TM_mday = 2;
LTM.TM_Hour = 1;
LTM.TM_min = 1;
LTM.TM_sec = 1;
LTM.TM_wday = 0;

//转换为秒数,这也将填充 tm_wday 和 tm_yday
struct timespec TSPEC;
TSPEC.tv_nsec = 0;
TSPEC.tv_sec = mktime (&LTM); 

执行代码后、我得到的值是 TSPEC.tv_sec=1640998861sec。但根据 epoch 时间转换器、其值应为 1641085261 sec

我发现它 比实际时间少86400s。

我找不到问题。  

谢谢、  

Dinkar

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Dinkar 您好!

    不幸的是、我对这个时间库没有任何经验。  您是否能够找到错误的来源?  是否可能由于时钟精度而导致误差?   

    谢谢、

    JD