Items in search results
Leitch NEO FR-3901 Chassis w/ (2x) XHD-3902 & 3901RES-E Modules
- C $106.39
- Buy It Now
- +C $52.09 shipping
Neo Leitch FR-3901 1RU Mounting Frame w/ Four Module Slots, Excellent Condition!
- C $131.68
- or Best Offer
- +C $157.72 shipping
Leitch NEO FR-3901 Frame w/ MGI-3901 MGI-3901-SD
- C $399.02
- or Best Offer
- +C $133.57 shipping
Leitch NEO FR-3901 Frame w/ 2x ARC-3901
- C $266.01
- or Best Offer
- +C $131.53 shipping
Leitch NEO FR-3901 Frame w/ 4-XHD-3902 HD Upconversion & Cross Modules, PS
- C $432.28
- Buy It Now
- +C $96.25 shipping
Leitch Neo Fr-3901 Modular Card Frame UNTESTED
- C $226.10
- Buy It Now
- +C $88.85 shipping
Leitch FR-3903 Frame w/ 1x DES-3901, 1x AVS-3902-C & 3x VFS-3901 Modules, 3x PSU
- C $212.80
- or Best Offer
- +C $68.75 shipping
Neo Leitch FR-3903 Frame w/ DMX-3901-A,MSA-3901-A, DES-3901-S Modules (4 each)
- C $1,860.81
- or Best Offer
- +C $138.90 shipping
Leitch NEO FR-3901 Chassis w/ XHD-3902 & 3901RES-E
- C $186.21
- or Best Offer
- +C $65.19 shipping
Leitch Neo FR-3903 w/ DMX-3901-A, MSA-3901-A, DES-3901-A, SFS-3901, and 3901BBM
- C $1,596.11
- or Best Offer
- +C $134.85 shipping
Leitch Neo FR-3903 w/ DMX-3901-A, MSA-3901-A, DES-3901-A, SFS-3901, and 3901BBM
- C $1,529.60
- or Best Offer
- +C $133.83 shipping
Leitch Neo Modular Panel System Boards DVR-3901 & 3901RES-E Model FR-3901
- C $667.05List price: Previous PriceC $784.76
- or Best Offer
- +C $143.98 shipping
- C $667.05
LEITCH NEO FR 3901
- C $294.39
- or Best Offer
- +C $36.80 shipping
Leitch CSD-3901 break out board CSD-3901BO
- C $66.49
- or Best Offer
- +C $22.33 shipping
Leitch NEO FR-3923 Frame w/ AVM-3902-C4 and 3901BBM Modules
- C $1,330.09
- or Best Offer
- +C $130.78 shipping
Leitch NEO FR-3923 Frame w/ AVM-3902-C4 and 3901BBM Modules
- C $1,529.60
- or Best Offer
- +C $133.83 shipping
Leitch Neo FR-3903 3RU Frame
- C $999.99
- or Best Offer
- Shipping not specified
Leitch NEO FR-3901 Chassis w/ VEA-3901 + NSM-8X1SHD
- C $106.41
- or Best Offer
- +C $49.71 shipping
Leitch FR-3923 Neo Frame w/ 2x ARC-3901 & 1x ACO-3901 Boards
- C $134.33
- or Best Offer
- +C $55.48 shipping
Leitch ADC-3901 FM Video ADC Qty 3 & DAS-3901FM Modules
- C $73.16
- Buy It Now
- +C $66.93 shipping
Leitch NEO Power PC Control Card 3901RES-E
- C $266.01
- Buy It Now
- +C $29.67 shipping
Leitch NEO Power PC Control Card 3901RES-E
- C $239.40
- Buy It Now
- +C $29.28 shipping
LEITCH Neo FR-3901 SIGNAL DIST & CONVERSION with CSD-3901 card
- C $399.03
- Buy It Now
- +C $99.76 shipping
Leitch NEO FR-3923 with GPI XHD-3902 card module pulled from working environment
- C $997.58
- or Best Offer
- +C $121.42 shipping
Leitch Neo FR-3923 Frame Audio/Video Synchronizer w/ 2x(XHD3902), 2x(XHD-3902-BC
- C $518.74
- or Best Offer
- +C $181.89 shipping
Leitch Neo FR-3903 Frame w/ 8 Card Modules and 2x Power Supplies #1
- C $133.01
- or Best Offer
- +C $105.52 shipping
Leitch Neo FR-3923 Frame w/ 8 Card Modules and 2x Power Supplies #2
- C $133.01
- or Best Offer
- +C $105.52 shipping
Leitch FR6802+ Frame w/ (16) VEA6800+ Cards and (2) 6802+PS Power Supplies 6800
- C $389.04
- or Best Offer
- +C $155.89 shipping
Leitch FR-3610 Digibus 3U Frame Digital Controller w/ 21 Modules
- C $79.79
- or Best Offer
- +C $204.57 shipping
LEITCH FR6802+ VIDEO MODULE FRAME NEW
- C $521.39
- or Best Offer
- +C $60.19 shipping
Leitch FR3903 3RU Frame - As Is
- C $931.07
- or Best Offer
- +C $350.93 shipping
Leitch VFS-3901H-FM 3901MF-HD MULITI FUNCTION- HIGH DEFINITION W/Rear Panel
- C $665.04
- or Best Offer
- +C $26.75 shipping
Leitch Neo FR-3923 UNTESTED
- C $119.70
- or Best Offer
- +C $25.70 shipping
Leitch Mix Box Audio FR-880MB w/ VEA-681 Module
- C $66.49
- or Best Offer
- +C $19.35 shipping
Leitch FR-6804 Frame w/ 2 Power Supplies, 10 Back Planes
- C $118.15
- Buy It Now
- +C $56.13 shipping
LEITCH HARRIS 6800 PLUS FR6802+ MODULAR VIDEO FRAME ROUTER w/SRD6800+ MFD CARD
- C $132.97
- or Best Offer
- +C $165.53 shipping
Leitch FR-6804-1 Digital Glue Frame w/Power Supplies
- C $30.02
- Buy It Now
- +C $86.87 shipping
Leitch Power supply for NEO FR-3923 P/N: TC61S-1445 3923PS NEO 300-P3218D
- C $29.26
- or Best Offer
- +C $36.03 shipping
Leitch NEO FR-3923 fan card
- C $13.29
- 0 bids
- C $26.59
- Buy It Now
- +C $31.92 shipping
Leitch (A2) SFS3901 Multifunction Video Procamp SFS-3901-FM Card
- C $119.23
- Buy It Now
- +C $20.16 shipping
Leitch FR6802+ Frame w/ (8) VSE6800+ Cards and (2) DSK-6801 Power Supplies 6800
- C $119.70
- or Best Offer
- Shipping not specified
Leitch ENS3901-fm Encoder Sychronizer UNTESTED
- C $66.49
- or Best Offer
- +C $17.89 shipping
Leitch DAS3901-FM decoder /sync with audio mux UNTESTED
- C $66.49
- or Best Offer
- +C $17.89 shipping
Leitch (A2) VFS-3901 Multifunction - Standard Definition Card
- C $63.23
- or Best Offer
- +C $19.30 shipping
Leitch 6800 Plus FR6802 w/ 1x VSE6800+ VSM6800+ VEA6800+ ,3x ARG6800
- C $532.03
- or Best Offer
- +C $157.26 shipping
LEITCH - MODEL #FR-683 VIDEO DA FRAME
- C $53.20
- or Best Offer
- +C $106.49 shipping
Leitch FR-684 Video Distribution Amplifier
- C $66.97
- or Best Offer
- +C $148.24 shipping
Leitch Mix Box Audio FR-880MB (no Module)
- C $53.19
- or Best Offer
- +C $19.15 shipping
Leitch 6800 Plus FR6802 w/ 4x VSE6800+ DMX6800+C4D MXA6800+C4D other modules
- C $665.04
- or Best Offer
- +C $159.29 shipping
Leitch 6800 Plus FR6802 w/ 5x VSE6800+ DMX6800+C4D MXA6800+C4D other modules
- C $798.05
- or Best Offer
- +C $161.33 shipping
Join GitHub today
Leitch CSD-5300. I know that xntpd claims to support the CSD-5300 clock, however, I'm a little stuck on the details. We do have two CSD-5300s (and about 6 racks of other Leitch gear;) which are (apparently) fed time sync from a GPS receiver. However, the CSD-5300 appears to only. Leitch Csd 5300 Manual Transfer. The interval is configurable. Starting any daemon in a chroot jail n. The NTP service is restricted to servers in the /etc/ntp. Ask your network administrator if n. To delete an existing synchronization peer, n. To browse for the device, n. By default, it is set to notrap n.
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up Find file Copy path
![Leitch Csd 5300 Manualidades Leitch Csd 5300 Manualidades](https://i.pinimg.com/236x/68/20/e5/6820e5b8fc5300cece743fd1bc7391e6--mr-wonderful-agenda-planner.jpg)
Cannot retrieve contributors at this time
/* |
* refclock_leitch - clock driver for the Leitch CSD-5300 Master Clock |
*/ |
#ifdef HAVE_CONFIG_H |
# include<config.h> |
#endif |
#if defined(REFCLOCK) && defined(CLOCK_LEITCH) |
#include'ntpd.h' |
#include'ntp_io.h' |
#include'ntp_refclock.h' |
#include'ntp_unixtime.h' |
#include<stdio.h> |
#include<ctype.h> |
#ifdef STREAM |
#include<stropts.h> |
#if defined(LEITCHCLK) |
#include<sys/clkdefs.h> |
#endif/* LEITCHCLK */ |
#endif/* STREAM */ |
#include'ntp_stdlib.h' |
/* |
* Driver for Leitch CSD-5300 Master Clock System |
* |
* COMMANDS: |
* DATE: D <CR> |
* TIME: T <CR> |
* STATUS: S <CR> |
* LOOP: L <CR> |
* |
* FORMAT: |
* DATE: YYMMDD<CR> |
* TIME: <CR>/HHMMSS <CR>/HHMMSS <CR>/HHMMSS <CR>/ |
* second bondaried on the stop bit of the <CR> |
* second boundaries at '/' above. |
* STATUS: G (good), D (diag fail), T (time not provided) or |
* P (last phone update failed) |
*/ |
#definePRECISION (-20) /* 1x10-8 */ |
#defineMAXUNITS1/* max number of LEITCH units */ |
#defineLEITCHREFID'ATOM'/* reference id */ |
#defineLEITCH_DESCRIPTION'Leitch: CSD 5300 Master Clock System Driver' |
#defineLEITCH232'/dev/leitch%d'/* name of radio device */ |
#defineSPEED232 B300 /* uart speed (300 baud) */ |
#ifdef DEBUG |
#defineleitch_send(A,M) |
if (debug) fprintf(stderr,'write leitch %sn',M); |
if ((write(A->leitchio.fd,M,sizeof(M)) < 0)) { |
if (debug) |
fprintf(stderr, 'leitch_send: unit %d send failedn', A->unit); |
else |
msyslog(LOG_ERR, 'leitch_send: unit %d send failed %m',A->unit);} |
#else |
#defineleitch_send(A,M) |
if ((write(A->leitchio.fd,M,sizeof(M)) < 0)) { |
msyslog(LOG_ERR, 'leitch_send: unit %d send failed %m',A->unit);} |
#endif |
#defineSTATE_IDLE0 |
#defineSTATE_DATE1 |
#defineSTATE_TIME12 |
#defineSTATE_TIME23 |
#defineSTATE_TIME34 |
/* |
* LEITCH unit control structure |
*/ |
struct leitchunit { |
struct peer *peer; |
struct refclockio leitchio; |
u_char unit; |
short year; |
short yearday; |
short month; |
short day; |
short hour; |
short second; |
short minute; |
short state; |
u_short fudge1; |
l_fp reftime1; |
l_fp reftime2; |
l_fp reftime3; |
l_fp codetime1; |
l_fp codetime2; |
l_fp codetime3; |
u_long yearstart; |
}; |
/* |
* Function prototypes |
*/ |
staticvoidleitch_init (void); |
staticintleitch_start (int, struct peer *); |
staticvoidleitch_shutdown (int, struct peer *); |
staticvoidleitch_poll (int, struct peer *); |
staticvoidleitch_control (int, struct refclockstat *, struct refclockstat *, struct peer *); |
#defineleitch_buginfo noentry |
staticvoidleitch_receive (struct recvbuf *); |
staticvoidleitch_process (struct leitchunit *); |
#if0 |
static void leitch_timeout (struct peer *); |
#endif |
staticintleitch_get_date (struct recvbuf *, struct leitchunit *); |
staticintleitch_get_time (struct recvbuf *, struct leitchunit *, int); |
staticintdays_per_year (int); |
staticstruct leitchunit leitchunits[MAXUNITS]; |
staticu_char unitinuse[MAXUNITS]; |
staticu_char stratumtouse[MAXUNITS]; |
static u_int32 refid[MAXUNITS]; |
staticchar days_in_month [] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
/* |
* Transfer vector |
*/ |
struct refclock refclock_leitch = { |
leitch_start, leitch_shutdown, leitch_poll, |
leitch_control, leitch_init, leitch_buginfo, NOFLAGS |
}; |
/* |
* leitch_init - initialize internal leitch driver data |
*/ |
staticvoid |
leitch_init(void) |
{ |
int i; |
memset((char*)leitchunits, 0, sizeof(leitchunits)); |
memset((char*)unitinuse, 0, sizeof(unitinuse)); |
for (i = 0; i < MAXUNITS; i++) |
memcpy((char *)&refid[i], LEITCHREFID, 4); |
} |
/* |
* leitch_shutdown - shut down a LEITCH clock |
*/ |
staticvoid |
leitch_shutdown( |
int unit, |
struct peer *peer |
) |
{ |
struct leitchunit *leitch; |
if (unit >= MAXUNITS) { |
return; |
} |
leitch = &leitchunits[unit]; |
if (-1 != leitch->leitchio.fd) |
io_closeclock(&leitch->leitchio); |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, 'leitch_shutdown()n'); |
#endif |
} |
/* |
* leitch_poll - called by the transmit procedure |
*/ |
staticvoid |
leitch_poll( |
int unit, |
struct peer *peer |
) |
{ |
struct leitchunit *leitch; |
/* start the state machine rolling */ |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, 'leitch_poll()n'); |
#endif |
if (unit >= MAXUNITS) { |
/* XXXX syslog it */ |
return; |
} |
leitch = &leitchunits[unit]; |
if (leitch->state != STATE_IDLE) { |
/* reset and wait for next poll */ |
/* XXXX syslog it */ |
leitch->state = STATE_IDLE; |
} else { |
leitch_send(leitch,'Dr'); |
leitch->state = STATE_DATE; |
} |
} |
staticvoid |
leitch_control( |
int unit, |
struct refclockstat *in, |
struct refclockstat *out, |
struct peer *passed_peer |
) |
{ |
if (unit >= MAXUNITS) { |
msyslog(LOG_ERR, |
'leitch_control: unit %d invalid', unit); |
return; |
} |
if (in) { |
if (in->haveflags & CLK_HAVEVAL1) |
stratumtouse[unit] = (u_char)(in->fudgeval1); |
if (in->haveflags & CLK_HAVEVAL2) |
refid[unit] = in->fudgeval2; |
if (unitinuse[unit]) { |
struct peer *peer; |
peer = (&leitchunits[unit])->peer; |
peer->stratum = stratumtouse[unit]; |
peer->refid = refid[unit]; |
} |
} |
if (out) { |
memset((char *)out, 0, sizeof (struct refclockstat)); |
out->type = REFCLK_ATOM_LEITCH; |
out->haveflags = CLK_HAVEVAL1 | CLK_HAVEVAL2; |
out->fudgeval1 = (int32)stratumtouse[unit]; |
out->fudgeval2 = refid[unit]; |
out->p_lastcode = ''; |
out->clockdesc = LEITCH_DESCRIPTION; |
} |
} |
/* |
* leitch_start - open the LEITCH devices and initialize data for processing |
*/ |
staticint |
leitch_start( |
int unit, |
struct peer *peer |
) |
{ |
struct leitchunit *leitch; |
int fd232; |
char leitchdev[20]; |
/* |
* Check configuration info. |
*/ |
if (unit >= MAXUNITS) { |
msyslog(LOG_ERR, 'leitch_start: unit %d invalid', unit); |
return (0); |
} |
if (unitinuse[unit]) { |
msyslog(LOG_ERR, 'leitch_start: unit %d in use', unit); |
return (0); |
} |
/* |
* Open serial port. |
*/ |
snprintf(leitchdev, sizeof(leitchdev), LEITCH232, unit); |
fd232 = open(leitchdev, O_RDWR, 0777); |
if (fd232 -1) { |
msyslog(LOG_ERR, |
'leitch_start: open of %s: %m', leitchdev); |
return (0); |
} |
leitch = &leitchunits[unit]; |
memset(leitch, 0, sizeof(*leitch)); |
#if defined(HAVE_SYSV_TTYS) |
/* |
* System V serial line parameters (termio interface) |
* |
*/ |
{ struct termio ttyb; |
if (ioctl(fd232, TCGETA, &ttyb) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, TCGETA): %m', leitchdev); |
goto screwed; |
} |
ttyb.c_iflag = IGNBRK|IGNPAR|ICRNL; |
ttyb.c_oflag = 0; |
ttyb.c_cflag = SPEED232|CS8|CLOCAL|CREAD; |
ttyb.c_lflag = ICANON; |
ttyb.c_cc[VERASE] = ttyb.c_cc[VKILL] = '0'; |
if (ioctl(fd232, TCSETA, &ttyb) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, TCSETA): %m', leitchdev); |
goto screwed; |
} |
} |
#endif/* HAVE_SYSV_TTYS */ |
#if defined(HAVE_TERMIOS) |
/* |
* POSIX serial line parameters (termios interface) |
* |
* The LEITCHCLK option provides timestamping at the driver level. |
* It requires the tty_clk streams module. |
*/ |
{ struct termios ttyb, *ttyp; |
ttyp = &ttyb; |
if (tcgetattr(fd232, ttyp) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: tcgetattr(%s): %m', leitchdev); |
goto screwed; |
} |
ttyp->c_iflag = IGNBRK|IGNPAR|ICRNL; |
ttyp->c_oflag = 0; |
ttyp->c_cflag = SPEED232|CS8|CLOCAL|CREAD; |
ttyp->c_lflag = ICANON; |
ttyp->c_cc[VERASE] = ttyp->c_cc[VKILL] = '0'; |
if (tcsetattr(fd232, TCSANOW, ttyp) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: tcsetattr(%s): %m', leitchdev); |
goto screwed; |
} |
if (tcflush(fd232, TCIOFLUSH) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: tcflush(%s): %m', leitchdev); |
goto screwed; |
} |
} |
#endif/* HAVE_TERMIOS */ |
#ifdef STREAM |
#if defined(LEITCHCLK) |
if (ioctl(fd232, I_PUSH, 'clk') < 0) |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, I_PUSH, clk): %m', leitchdev); |
if (ioctl(fd232, CLK_SETSTR, 'n') < 0) |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, CLK_SETSTR): %m', leitchdev); |
#endif/* LEITCHCLK */ |
#endif/* STREAM */ |
#if defined(HAVE_BSD_TTYS) |
/* |
* 4.3bsd serial line parameters (sgttyb interface) |
* |
* The LEITCHCLK option provides timestamping at the driver level. |
* It requires the tty_clk line discipline and 4.3bsd or later. |
*/ |
{ struct sgttyb ttyb; |
#if defined(LEITCHCLK) |
int ldisc = CLKLDISC; |
#endif/* LEITCHCLK */ |
if (ioctl(fd232, TIOCGETP, &ttyb) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, TIOCGETP): %m', leitchdev); |
goto screwed; |
} |
ttyb.sg_ispeed = ttyb.sg_ospeed = SPEED232; |
#if defined(LEITCHCLK) |
ttyb.sg_erase = ttyb.sg_kill = 'r'; |
ttyb.sg_flags = RAW; |
#else |
ttyb.sg_erase = ttyb.sg_kill = '0'; |
ttyb.sg_flags = EVENP|ODDP|CRMOD; |
#endif/* LEITCHCLK */ |
if (ioctl(fd232, TIOCSETP, &ttyb) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, TIOCSETP): %m', leitchdev); |
goto screwed; |
} |
#if defined(LEITCHCLK) |
if (ioctl(fd232, TIOCSETD, &ldisc) < 0) { |
msyslog(LOG_ERR, |
'leitch_start: ioctl(%s, TIOCSETD): %m',leitchdev); |
goto screwed; |
} |
#endif/* LEITCHCLK */ |
} |
#endif/* HAVE_BSD_TTYS */ |
/* |
* Set up the structures |
*/ |
leitch->peer = peer; |
leitch->unit = unit; |
leitch->state = STATE_IDLE; |
leitch->fudge1 = 15; /* 15ms */ |
leitch->leitchio.clock_recv = leitch_receive; |
leitch->leitchio.srcclock = (caddr_t) leitch; |
leitch->leitchio.datalen = 0; |
leitch->leitchio.fd = fd232; |
if (!io_addclock(&leitch->leitchio)) { |
leitch->leitchio.fd = -1; |
goto screwed; |
} |
/* |
* All done. Initialize a few random peer variables, then |
* return success. |
*/ |
peer->precision = PRECISION; |
peer->stratum = stratumtouse[unit]; |
peer->refid = refid[unit]; |
unitinuse[unit] = 1; |
return(1); |
/* |
* Something broke; abandon ship. |
*/ |
screwed: |
close(fd232); |
return(0); |
} |
/* |
* leitch_receive - receive data from the serial interface on a leitch |
* clock |
*/ |
staticvoid |
leitch_receive( |
struct recvbuf *rbufp |
) |
{ |
struct leitchunit *leitch = (struct leitchunit *)rbufp->recv_srcclock; |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, 'leitch_recieve(%*.*s)n', |
rbufp->recv_length, rbufp->recv_length, |
rbufp->recv_buffer); |
#endif |
if (rbufp->recv_length != 7) |
return; /* The date is return with a trailing newline, |
discard it. */ |
switch (leitch->state) { |
case STATE_IDLE: /* unexpected, discard and resync */ |
return; |
case STATE_DATE: |
if (!leitch_get_date(rbufp,leitch)) { |
leitch->state = STATE_IDLE; |
break; |
} |
leitch_send(leitch,'Tr'); |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, '%un',leitch->yearday); |
#endif |
leitch->state = STATE_TIME1; |
break; |
case STATE_TIME1: |
if (!leitch_get_time(rbufp,leitch,1)) { |
} |
if (!clocktime(leitch->yearday,leitch->hour,leitch->minute, |
leitch->second, 1, rbufp->recv_time.l_ui, |
&leitch->yearstart, &leitch->reftime1.l_ui)) { |
leitch->state = STATE_IDLE; |
break; |
} |
leitch->reftime1.l_uf = 0; |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, '%lun', (u_long)leitch->reftime1.l_ui); |
#endif |
MSUTOTSF(leitch->fudge1, leitch->reftime1.l_uf); |
leitch->codetime1 = rbufp->recv_time; |
leitch->state = STATE_TIME2; |
break; |
case STATE_TIME2: |
if (!leitch_get_time(rbufp,leitch,2)) { |
} |
if (!clocktime(leitch->yearday,leitch->hour,leitch->minute, |
leitch->second, 1, rbufp->recv_time.l_ui, |
&leitch->yearstart, &leitch->reftime2.l_ui)) { |
leitch->state = STATE_IDLE; |
break; |
} |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, '%lun', (u_long)leitch->reftime2.l_ui); |
#endif |
MSUTOTSF(leitch->fudge1, leitch->reftime2.l_uf); |
leitch->codetime2 = rbufp->recv_time; |
leitch->state = STATE_TIME3; |
break; |
case STATE_TIME3: |
if (!leitch_get_time(rbufp,leitch,3)) { |
} |
if (!clocktime(leitch->yearday,leitch->hour,leitch->minute, |
leitch->second, GMT, rbufp->recv_time.l_ui, |
&leitch->yearstart, &leitch->reftime3.l_ui)) { |
leitch->state = STATE_IDLE; |
break; |
} |
#ifdef DEBUG |
if (debug) |
fprintf(stderr, '%lun', (u_long)leitch->reftime3.l_ui); |
#endif |
MSUTOTSF(leitch->fudge1, leitch->reftime3.l_uf); |
leitch->codetime3 = rbufp->recv_time; |
leitch_process(leitch); |
leitch->state = STATE_IDLE; |
break; |
default: |
msyslog(LOG_ERR, |
'leitech_receive: invalid state %d unit %d', |
leitch->state, leitch->unit); |
} |
} |
/* |
* leitch_process - process a pile of samples from the clock |
* |
* This routine uses a three-stage median filter to calculate offset and |
* dispersion. reduce jitter. The dispersion is calculated as the span |
* of the filter (max - min), unless the quality character (format 2) is |
* non-blank, in which case the dispersion is calculated on the basis of |
* the inherent tolerance of the internal radio oscillator, which is |
* +-2e-5 according to the radio specifications. |
*/ |
staticvoid |
leitch_process( |
struct leitchunit *leitch |
) |
{ |
l_fp off; |
l_fp tmp_fp; |
/*double doffset;*/ |
off = leitch->reftime1; |
L_SUB(&off,&leitch->codetime1); |
tmp_fp = leitch->reftime2; |
L_SUB(&tmp_fp,&leitch->codetime2); |
if (L_ISGEQ(&off,&tmp_fp)) |
off = tmp_fp; |
tmp_fp = leitch->reftime3; |
L_SUB(&tmp_fp,&leitch->codetime3); |
if (L_ISGEQ(&off,&tmp_fp)) |
off = tmp_fp; |
/*LFPTOD(&off, doffset);*/ |
refclock_receive(leitch->peer); |
} |
/* |
* days_per_year |
*/ |
staticint |
days_per_year( |
int year |
) |
{ |
if (year%4) { /* not a potential leap year */ |
return (365); |
} else { |
if (year % 100) { /* is a leap year */ |
return (366); |
} else { |
if (year % 400) { |
return (365); |
} else { |
return (366); |
} |
} |
} |
} |
staticint |
leitch_get_date( |
struct recvbuf *rbufp, |
struct leitchunit *leitch |
) |
{ |
int i; |
if (rbufp->recv_length < 6) |
return(0); |
#undef BAD /* confict: defined as (-1) in AIX sys/param.h */ |
#defineBAD(A) (rbufp->recv_buffer[A] < '0') || (rbufp->recv_buffer[A] > '9') |
if (BAD(0)||BAD(1)||BAD(2)||BAD(3)||BAD(4)||BAD(5)) |
return(0); |
#defineATOB(A) ((rbufp->recv_buffer[A])-'0') |
leitch->year = ATOB(0)*10 + ATOB(1); |
leitch->month = ATOB(2)*10 + ATOB(3); |
leitch->day = ATOB(4)*10 + ATOB(5); |
/* sanity checks */ |
if (leitch->month > 12) |
return(0); |
if (leitch->day > days_in_month[leitch->month-1]) |
return(0); |
/* calculate yearday */ |
i = 0; |
leitch->yearday = leitch->day; |
while ( i < (leitch->month-1) ) |
leitch->yearday += days_in_month[i++]; |
if ((days_per_year((leitch->year>90?1900:2000)+leitch->year)365) && |
leitch->month > 2) |
leitch->yearday--; |
return(1); |
} |
/* |
* leitch_get_time |
*/ |
staticint |
leitch_get_time( |
struct recvbuf *rbufp, |
struct leitchunit *leitch, |
int which |
) |
{ |
if (BAD(0)||BAD(1)||BAD(2)||BAD(3)||BAD(4)||BAD(5)) |
return(0); |
leitch->hour = ATOB(0)*10 +ATOB(1); |
leitch->minute = ATOB(2)*10 +ATOB(3); |
leitch->second = ATOB(4)*10 +ATOB(5); |
if ((leitch->hour > 23) || (leitch->minute > 60) || |
(leitch->second > 60)) |
return(0); |
return(1); |
} |
#else |
int refclock_leitch_bs; |
#endif/* REFCLOCK */ |
Leitch Csd 5300 Manual
Copy lines Copy permalink