SNVS Timers and the C Standard Library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SNVS Timers and the C Standard Library

980 次查看
jeffthompson
Contributor V

MCUXpresso SDK (2.6.2) seems to be missing time support, at least as far as the C standard library (C90, C99) is concerned. I need to convert snvs_hp_rtc_datetime_t to time_t, which is what mktime() would normally do, but that requires a struct tm. Alternatively, if time were available as, or convertible to, type time_t, I could work with that.

标记 (2)
0 项奖励
回复
3 回复数

895 次查看
jeffthompson
Contributor V

I'm using the MIMXRT1062DVJ6A with MCUXpresso 2.6.2. I also need millisecond time resolution, but the SNVS doesn't seem to provide that.

0 项奖励
回复

895 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Jeff Thompson

Yes, as we are working in a embedded system, we tried to optimize our resources, this is why the datetime structure is like:

//    typedef struct _snvs_hp_rtc_datetime
//    {
//        uint16_t year;  /*!< Range from 1970 to 2099.*/
//        uint8_t month;  /*!< Range from 1 to 12.*/
//        uint8_t day;    /*!< Range from 1 to 31 (depending on month).*/
//        uint8_t hour;   /*!< Range from 0 to 23.*/
//        uint8_t minute; /*!< Range from 0 to 59.*/
//        uint8_t second; /*!< Range from 0 to 59.*/
//    } snvs_hp_rtc_datetime_t;

If you need it, you could create a new time variable with the structure of time.h :

//    struct tm 
//    {
//        int tm_sec;   /* seconds after the minute, 0 to 60
//                         (0 - 60 allows for the occasional leap second) */
//        int tm_min;   /* minutes after the hour, 0 to 59 */
//        int tm_hour;  /* hours since midnight, 0 to 23 */
//        int tm_mday;  /* day of the month, 1 to 31 */
//        int tm_mon;   /* months since January, 0 to 11 */
//        int tm_year;  /* years since 1900 */
//        int tm_wday;  /* days since Sunday, 0 to 6 */
//        int tm_yday;  /* days since January 1, 0 to 365 */
//        int tm_isdst; /* Daylight Savings Time flag */
//    };

Sorry for the inconvenieces that this may cause you.

Best regards

0 项奖励
回复

895 次查看
nxf45548
NXP Employee
NXP Employee

To assist you properly,can you please provide us the part number that you are using?

0 项奖励
回复