SNTP use - VxWorks

This is a discussion on SNTP use - VxWorks ; Hi, I got SNTP built into my kernel image but now I'm not sure how to get it to work. The Windriver documentation makes reference to a sntpcTimeGet() function, but there's no info on how it works. Do I need ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SNTP use

  1. SNTP use

    Hi,

    I got SNTP built into my kernel image but now I'm not sure how to get
    it to work. The Windriver documentation makes reference to a
    sntpcTimeGet() function, but there's no info on how it works. Do I
    need to pass it a pointer to a timespec structure?

    Does anyone have a simple example of using sntp?

    Many thanks.

    John


  2. Re: SNTP use

    I ended up writing the following. Hope this helps someone else.

    //Includes used to set and display clock
    #include
    #include
    #include
    #include

    /*Get network time*/
    struct timespec tspec;
    STATUS sntpc_status= ERROR;
    STATUS settime_status= ERROR;
    time_t li_curr_time = 0;

    printf("Setting clock with sntp from server %s\n",
    SNTPC_PRIMARY_IPV4_ADDR);

    sntpc_status = sntpcTimeGet(SNTPC_PRIMARY_IPV4_ADDR, SNTP_TIMEOUT,
    &tspec);

    if (sntpc_status != OK) {
    printf("sntpcTimeGet failed\n");
    printf("Returned sntpc_status: %i errno: %s\n", sntpc_status,
    strerror(errno));
    } else {
    /*Set clock to received date and time*/
    settime_status = clock_settime(CLOCK_REALTIME, &tspec);

    if (settime_status != OK) {
    printf("clock_settime failed\n");
    printf("Returned settime_status: %i errno: %s\n", settime_status,
    strerror(errno));
    } else {
    printf("Successfull set the system clock.\n");
    }
    }

    /*Display network time*/
    time(&li_curr_time);
    printf("The current GMT is: %s\n", ctime(&li_curr_time));

  3. Re: SNTP use

    i am using tornado 2.2
    i created a boot floppy and i got vxboot prompt in taget console machine and it showing


    Attaching floppy disk device... done
    loading vxWork... a82+649366784
    starting at 0xe6e904


    MUXLOAD faild


    then its asking press any key to stop auto-boot...

    in host machine target server showing some problem

    Connecting to target agent... Error: clnttty_rcv: read timed out Error: clnttty_rcv: read timed out
    Error: rpccore backend client Timed out
    failed.

    plzz help me....


    i want to dump vxworks image into my target machine

+ Reply to Thread