Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/ntp/libparse/clk_varitext.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#ifndef PARSESTREAM | #ifndef PARSESTREAM | ||||
# include "ntp_stdlib.h" | # include "ntp_stdlib.h" | ||||
# include <stdio.h> | # include <stdio.h> | ||||
#else | #else | ||||
# include "sys/parsestreams.h" | # include "sys/parsestreams.h" | ||||
extern int printf (const char *, ...); | extern int printf (const char *, ...); | ||||
#endif | #endif | ||||
static const u_char VT_INITIALISED = 0x01; | /* static const u_char VT_INITIALISED = 0x01; */ | ||||
static const u_char VT_SYNCHRONISED = 0x02; | /* static const u_char VT_SYNCHRONISED = 0x02; */ | ||||
static const u_char VT_ALARM_STATE = 0x04; | /* static const u_char VT_ALARM_STATE = 0x04; */ | ||||
static const u_char VT_BST = 0x08; | static const u_char VT_BST = 0x08; | ||||
static const u_char VT_SEASON_CHANGE = 0x10; | /* static const u_char VT_SEASON_CHANGE = 0x10; */ | ||||
static const u_char VT_LAST_TELEGRAM_OK = 0x20; | /* static const u_char VT_LAST_TELEGRAM_OK = 0x20; */ | ||||
/* | /* | ||||
* The Varitext receiver sends a datagram in the following format every minute | * The Varitext receiver sends a datagram in the following format every minute | ||||
* | * | ||||
* Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLFSTXXX | * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLFSTXXX | ||||
* Pos 0123456789012345678901 2 3 4567 | * Pos 0123456789012345678901 2 3 4567 | ||||
* 0000000000111111111122 2 2 2222 | * 0000000000111111111122 2 2 2222 | ||||
* Parse T: : : : : : : \r\n | * Parse T: : : : : : : \r\n | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | inp_varitext( | ||||
parse_t *parseio, | parse_t *parseio, | ||||
char ch, | char ch, | ||||
timestamp_t *tstamp | timestamp_t *tstamp | ||||
) | ) | ||||
{ | { | ||||
struct varitext *t = (struct varitext *)parseio->parse_pdata; | struct varitext *t = (struct varitext *)parseio->parse_pdata; | ||||
int rtc; | int rtc; | ||||
parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (long)parseio, ch)); | parseprintf(DD_PARSE, ("inp_varitext(0x%p, 0x%x, ...)\n", (void*)parseio, ch)); | ||||
if (!t) | if (!t) | ||||
return PARSE_INP_SKIP; /* local data not allocated - sigh! */ | return PARSE_INP_SKIP; /* local data not allocated - sigh! */ | ||||
if (ch == 'T') | if (ch == 'T') | ||||
t->tstamp = *tstamp; | t->tstamp = *tstamp; | ||||
if ((t->previous_ch == 'T') && (ch == ':')) | if ((t->previous_ch == 'T') && (ch == ':')) | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |