On Tue, Feb 14, 2023 at 09:00:54PM -0800, Richard Cochran wrote:
> @@ -205,6 +206,24 @@ static void do_set_action(struct pmc *pmc, int action, 
> int index, char *str)
>               }
>               pmc_send_set_action(pmc, code, &mtd, sizeof(mtd));
>               break;
> +     case MID_ALTERNATE_TIME_OFFSET_PROPERTIES:
> +             memset(&atop, 0, sizeof(atop));
> +             cnt = sscanf(str, " %*s %*s "
> +                          "keyField       %hhu "
> +                          "currentOffset  %d "
> +                          "jumpSeconds    %d "
> +                          "timeOfNextJump %u ",
> +                          &atop.keyField,
> +                          &atop.currentOffset,
> +                          &atop.jumpSeconds,
> +                          &atop.timeOfNextJump.seconds_lsb);

Another instance of the Y2106 problem :).

With this patch it works for me (new test in the testsuite):

--- a/pmc_common.c
+++ b/pmc_common.c
@@ -179,6 +179,7 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
        char onoff_port_state[4] = "off";
        char onoff_time_status[4] = "off";
        char display_name[11] = {0};
+       uint64_t jump;
        uint8_t key;
        int enable;
 
@@ -239,16 +240,18 @@ static void do_set_action(struct pmc *pmc, int action, 
int index, char *str)
                             "keyField       %hhu "
                             "currentOffset  %d "
                             "jumpSeconds    %d "
-                            "timeOfNextJump %u ",
+                            "timeOfNextJump %" SCNu64,
                             &atop.keyField,
                             &atop.currentOffset,
                             &atop.jumpSeconds,
-                            &atop.timeOfNextJump.seconds_lsb);
+                            &jump);
                if (cnt != 4) {
                        fprintf(stderr, "%s SET needs 4 values\n",
                                idtab[index].name);
                        break;
                }
+               atop.timeOfNextJump.seconds_lsb = jump & 0xffffffff;
+               atop.timeOfNextJump.seconds_msb = jump >> 32;
                pmc_send_set_action(pmc, code, &atop, sizeof(atop));
                break;
        case MID_GRANDMASTER_SETTINGS_NP:

The rest of the patchset looks good to me.

-- 
Miroslav Lichvar



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to