weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Data Structures | Defines | Functions | Variables
include/we-aut_sys/ntp.h File Reference

Overview

weAutSys' system calls and types for network time services

This file contains the definitions for weAutSys' system calls, services and types for using network time. They imply an uIP used as TCP/IP stack and weAutSys' timing / time keeping modules.

Please see also the modules Ethernet communications and Time keeping (date and time).

This is system software and must not be modified for user or application programs.

This file is part of weAutSys   <weinert-automation.de>

  Copyright © 2012 Albrecht Weinert, Bochum

Author:
Albrecht Weinert   <a-weinert.de>
Revision:
2
Date:
2017-01-25 17:49:03 +0100 (Mi, 25 Jan 2017)

Data Structures

struct  ntpMess_t
 NTP message type. More...
struct  ntpState_t
 Structure for NTP (client) application state. More...
struct  ntpTimestamp_t
 NTP time stamp type. More...

Defines

#define FLAGS_LI_MASK
 leap indicator bits in ntpMess_t::flags
#define FLAGS_MODE_MASK
 mode bits in ntpMess_t::flags
#define FLAGS_VERSION_MASK
 version bits in ntpMess_t::flags
#define LI_59SEC
 leap indicator 2 : minute = 59s
#define LI_61SEC
 leap indicator 1 : minute = 61s
#define LI_ALARM
 leap indicator 3 : alarm (clock not synchronized)
#define LI_NOWARN
 leap indicator 0 : no warning
#define NTP_ADJUSTAT_DIRMSK
 last adjustment direction mask
#define NTP_ADJUSTAT_MINUS
 last adjustment negative
#define NTP_ADJUSTAT_PLUS
 last adjustment positive
#define NTP_ADJUSTAT_PRV_MINUS
 previous (not last) adjustment negative
#define NTP_ADJUSTAT_PRV_MSK
 previous (not last) adjustment mask
#define NTP_ADJUSTAT_PRV_PLUS
 lprevious (not last) adjustment positive
#define NTP_ADJUSTAT_RNG_1S
 last adjustment range +1 second
#define NTP_ADJUSTAT_RNG_HM
 last adjustment range milliseconds
#define NTP_ADJUSTAT_RNG_HS
 last adjustment range seconds
#define NTP_ADJUSTAT_RNG_LM
 last adjustment range low milliseconds
#define NTP_ADJUSTAT_RNGMSK
 last adjustment range mask
#define NTP_BROADCAST
 NTP mode broadcast (5)
#define NTP_CLIENT
 NTP mode client (3)
#define NTP_FRACT_DROP
 Fraction byte significance.
#define NTP_PORT
 The well known NTP port.
#define NTP_SERVER
 NTP mode server (4)
#define NTP_STATE_CNETAB   0xE0
 connection established
#define NTP_STATE_CNPROB   0xF0
 connection problematic
#define NTP_STATE_CONN1   1
 Server known, port connected to server 1.
#define NTP_STATE_CONN2   2
 Server known, port connected to server 2.
#define NTP_STATE_CONTSY   0xC0
 continuous synchronisation
#define NTP_STATE_OPMSK
 Operation (bits) mask.
#define NTP_STATE_RESET   0
 No known NTP server, no NTP client operation.
#define NTP_STATE_SEPROB   0xB0
 server answer problematic (bogus, alarm)
#define NTP_STATE_SRVMSK
 Server (bits) mask.
#define NTP_STATE_TRYREQ   0x10
 try (first) request
#define NTP_STATE_W4REPL   8
 flag: waiting for server's reply
#define NTP_VERSION
 current version (4) within FLAGS_VERSION_MASK
#define ntpAsksPrio()
 NTP asks for priority.

Functions

void adjustNTPtime308UTC (struct ntpTimestamp_t *ntpTimeDif)
 Adjust the actual (system) time by a NTP time stamp difference.
ptfnct_t ntpAppcall (void)
 Handle NTP (server) events.
void ntpInit (uint8_t pref2)
 Initialise the NTP (client)
void ntpReset (void)
 Reset the NTP (client) to initial state.
void ntpTimestampDif (struct ntpTimestamp_t *result, struct ntpTimestamp_t *a, struct ntpTimestamp_t *b)
 Difference of two NTP time stamps.
void ntpTimestampHalf (struct ntpTimestamp_t *result) __attribute__((pure))
 Half a NTP time stamp value.
void ntpTimestampSum (struct ntpTimestamp_t *result, struct ntpTimestamp_t *a, struct ntpTimestamp_t *b)
 Sum of two NTP time stamps.
void ntpTimestampToMillies (uint16_t *ms, struct ntpTimestamp_t *ntpStamp)
 Milliseconds from a NTP time stamp's fraction.
void setNTPstampAct (struct ntpTimestamp_t *ntpTimestamp)
 Set a NTP time stamp to actual time.

Variables

struct ntpState_t ntpState
 the NTP state