summaryrefslogtreecommitdiff
path: root/libparse/clk_computime.c
diff options
context:
space:
mode:
Diffstat (limited to 'libparse/clk_computime.c')
-rw-r--r--libparse/clk_computime.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/libparse/clk_computime.c b/libparse/clk_computime.c
index 1068576..5026232 100644
--- a/libparse/clk_computime.c
+++ b/libparse/clk_computime.c
@@ -7,15 +7,15 @@
* /src/NTP/ntp4-dev/libparse/clk_computime.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
*
* clk_computime.c,v 4.10 2005/04/16 17:32:10 kardel RELEASE_20050508_A
- *
+ *
* Supports Diem's Computime Radio Clock
- *
+ *
* Used the Meinberg clock as a template for Diem's Computime Radio Clock
*
* adapted by Alois Camenzind <alois.camenzind@ubs.ch>
- *
+ *
* Copyright (c) 1995-2005 by Frank Kardel <kardel <AT> ntp.org>
- * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universität Erlangen-Nürnberg, Germany
+ * Copyright (c) 1989-1994 by Frank Kardel, Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -59,22 +59,22 @@ extern int printf (const char *, ...);
/*
* The Computime receiver sends a datagram in the following format every minute
- *
- * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF
+ *
+ * Timestamp T:YY:MM:MD:WD:HH:MM:SSCRLF
* Pos 0123456789012345678901 2 3
* 0000000000111111111122 2 2
* Parse T: : : : : : : rn
- *
- * T Startcharacter "T" specifies start of the timestamp
- * YY Year MM Month 1-12
- * MD Day of the month
- * WD Day of week
- * HH Hour
- * MM Minute
+ *
+ * T Startcharacter "T" specifies start of the timestamp
+ * YY Year MM Month 1-12
+ * MD Day of the month
+ * WD Day of week
+ * HH Hour
+ * MM Minute
* SS Second
- * CR Carriage return
+ * CR Carriage return
* LF Linefeed
- *
+ *
*/
static struct format computime_fmt =
@@ -88,10 +88,10 @@ static struct format computime_fmt =
0
};
-static u_long cvt_computime (unsigned char *, int, struct format *, clocktime_t *, void *);
-static unsigned long inp_computime (parse_t *, unsigned int, timestamp_t *);
+static parse_cvt_fnc_t cvt_computime;
+static parse_inp_fnc_t inp_computime;
-clockformat_t clock_computime =
+clockformat_t clock_computime =
{
inp_computime, /* Computime input handling */
cvt_computime, /* Computime conversion */
@@ -99,15 +99,15 @@ clockformat_t clock_computime =
(void *)&computime_fmt, /* conversion configuration */
"Diem's Computime Radio Clock", /* Computime Radio Clock */
24, /* string buffer */
- 0 /* no private data (complete pakets) */
+ 0 /* no private data (complete packets) */
};
/*
- * cvt_computime
- *
+ * parse_cvt_fnc_t cvt_computime
+ *
* convert simple type format
*/
-static u_long
+static u_long
cvt_computime(
unsigned char *buffer,
int size,
@@ -117,7 +117,7 @@ cvt_computime(
)
{
- if (!Strok(buffer, format->fixed_string)) {
+ if (!Strok(buffer, format->fixed_string)) {
return CVT_NONE;
} else {
if (Stoi(&buffer[format->field_offsets[O_DAY].offset], &clock_time->day,
@@ -131,7 +131,7 @@ cvt_computime(
Stoi(&buffer[format->field_offsets[O_MIN].offset], &clock_time->minute,
format->field_offsets[O_MIN].length) ||
Stoi(&buffer[format->field_offsets[O_SEC].offset], &clock_time->second,
- format->field_offsets[O_SEC].length)) {
+ format->field_offsets[O_SEC].length)) {
return CVT_FAIL | CVT_BADFMT;
} else {
@@ -144,31 +144,31 @@ cvt_computime(
}
/*
- * inp_computime
+ * parse_inp_fnc_t inp_computime
*
- * grep data from input stream
+ * grab data from input stream
*/
static u_long
inp_computime(
parse_t *parseio,
- unsigned int ch,
+ char ch,
timestamp_t *tstamp
)
{
unsigned int rtc;
-
+
parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
-
+
switch (ch)
{
case 'T':
parseprintf(DD_PARSE, ("inp_computime: START seen\n"));
-
+
parseio->parse_index = 1;
parseio->parse_data[0] = ch;
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
return PARSE_INP_SKIP;
-
+
case '\n':
parseprintf(DD_PARSE, ("inp_computime: END seen\n"));
if ((rtc = parse_addchar(parseio, ch)) == PARSE_INP_SKIP)