Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Problem with nrf5_calendar example

Dear,

I have integrated the nrf5_calendar example with "usbd_ble_uart" . Everything works correctly, but I have detected two possible errors (or I am doing something wrong):

ERROR 1: problem with the configured year. I can solve this by changing 1900 to 2000, but I don't know if it will affect another time.

ERROR 2: The function "nrf_cal_get_time_string" adds +1 to the configured month value (I have tried with different configurations and it always happens).

Notes:

SDK: nRF5_SDK_17.1.0_ddde560

EVB: nRF52833 DK

Any ideas?

Thank you very much for your help.

Raquel.

Parents
  • ERROR 1: problem with the configured year. I can solve this by changing 1900 to 2000, but I don't know if it will affect another time.

    I don't think you should do that. The reason is that the external time library expects to get the "year" parameter given as years after 1900. Please look up the "struct tm" in time.h.

    What sort of problem did you see? (your screenshot shows 1900 as being used), by the way.)

    ERROR 2: The function "nrf_cal_get_time_string" adds +1 to the configured month value (I have tried with different configurations and it always happens).

    This is also something that is decided by the external library. Please have a look at the struct (from 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 */
        union {       /* ABI-required extra fields, in a variety of types */
            struct {
                int __extra_1, __extra_2;
            };
            struct {
                long __extra_1_long, __extra_2_long;
            };
            struct {
                char *__extra_1_cptr, *__extra_2_cptr;
            };
            struct {
                void *__extra_1_vptr, *__extra_2_vptr;
            };
        };
    };
    

    Best regards,

    Edvin

Reply
  • ERROR 1: problem with the configured year. I can solve this by changing 1900 to 2000, but I don't know if it will affect another time.

    I don't think you should do that. The reason is that the external time library expects to get the "year" parameter given as years after 1900. Please look up the "struct tm" in time.h.

    What sort of problem did you see? (your screenshot shows 1900 as being used), by the way.)

    ERROR 2: The function "nrf_cal_get_time_string" adds +1 to the configured month value (I have tried with different configurations and it always happens).

    This is also something that is decided by the external library. Please have a look at the struct (from 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 */
        union {       /* ABI-required extra fields, in a variety of types */
            struct {
                int __extra_1, __extra_2;
            };
            struct {
                long __extra_1_long, __extra_2_long;
            };
            struct {
                char *__extra_1_cptr, *__extra_2_cptr;
            };
            struct {
                void *__extra_1_vptr, *__extra_2_vptr;
            };
        };
    };
    

    Best regards,

    Edvin

Children
No Data
Related