SNVS Timers and the C Standard Library

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SNVS Timers and the C Standard Library

1,057 Views
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.

Tags (2)
0 Kudos
Reply
3 Replies

972 Views
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 Kudos
Reply

972 Views
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 Kudos
Reply

972 Views
nxf45548
NXP Employee
NXP Employee

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

0 Kudos
Reply