Skip to content
This repository was archived by the owner on Jan 1, 2022. It is now read-only.
This repository was archived by the owner on Jan 1, 2022. It is now read-only.

htpdate isn't setting STA_UNSYNC ntp kernel flag #16

@Grabber

Description

@Grabber

t.c

#include <stdio.h>
#include <sys/timex.h>

int main(int argc, char *argv[]) {
   struct timex txc = {};
   int ret = adjtimex(&txc);

   fprintf(stdout, "adjtimex, ret=%d, STA_UNSYNC=%d, TIME_OK=%d, TIME_ERROR=%d\n", ret, (txc.status & STA_UNSYNC),
                                                                                        (ret==TIME_OK),
                                                                                        (ret==TIME_ERROR));

   return 0;
}
sudo ./htpdate -t -a -d <URL> -s -x
gcc t.c -o t; ./t
adjtimex, ret=5, STA_UNSYNC=64, TIME_OK=0, TIME_ERROR=1

http://linuxelf.com/blog/2017/03/27/clock-status-unsync/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions