#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <syslog.h>
#include <netdb.h>
#include <signal.h>
#include <ctype.h>
#include <stdarg.h>
#include <errno.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/fpgaconfa.h>
#include <sys/ioctl.h>
Include dependency graph for sntpdate.c:
Go to the source code of this file.
Data Structures | |
struct | ntp_stamp |
struct | ntpmsg |
Defines | |
#define | NTPDATE_FILE "/etc/sntpdate.conf" |
#define | NTPPORT 123 |
#define | NTPTIMEOUT 4 |
#define | MAXRETRY 5 |
#define | D(x) |
#define | D2(x) |
#define | D3(x) |
#define | TO_FRAC(x) ((unsigned long)((((ntp_double)x) * 1.0e-6) * NTP_SCALE)) |
#define | TO_USEC(x) ((unsigned long)((((ntp_double)x) * NTP_SCALE_I) * 1.0e6)) |
#define | USESYSLOG |
#define | MAXNUMSERVERS 10 |
#define | X313_WA_RTC_USEC 0x44 |
#define | X313_WA_RTC_SEC 0x45 |
Typedefs | |
typedef double | ntp_double |
Functions | |
void | set_rtc_fpga (struct timeval *) |
static void | log (char *str,...) |
static void | catch_signal (int sig) |
int | main (int argc, char **argv) |
Variables | |
const unsigned long | UNIX_NTP_DIFF = 2208988800U |
const ntp_double | NTP_SCALE = 4294967296.0 |
const ntp_double | NTP_SCALE_I = 2.3283064365e-10 |
const long | MILLION_L = 1000000 |
const ntp_double | MILLION_D = 1.0e6 |
const ntp_double | MILLION_D_I = 1.0e-6 |
static int | as_daemon = 0 |
static volatile int | check_config = 0 |
#define D | ( | x | ) |
Definition at line 102 of file sntpdate.c.
#define D2 | ( | x | ) |
Definition at line 106 of file sntpdate.c.
#define D3 | ( | x | ) |
Definition at line 107 of file sntpdate.c.
#define MAXNUMSERVERS 10 |
Referenced by main().
#define MAXRETRY 5 |
#define NTPDATE_FILE "/etc/sntpdate.conf" |
#define NTPPORT 123 |
#define NTPTIMEOUT 4 |
#define TO_FRAC | ( | x | ) | ((unsigned long)((((ntp_double)x) * 1.0e-6) * NTP_SCALE)) |
#define TO_USEC | ( | x | ) | ((unsigned long)((((ntp_double)x) * NTP_SCALE_I) * 1.0e6)) |
Definition at line 196 of file sntpdate.c.
#define USESYSLOG |
Definition at line 200 of file sntpdate.c.
#define X313_WA_RTC_SEC 0x45 |
#define X313_WA_RTC_USEC 0x44 |
typedef double ntp_double |
Definition at line 116 of file sntpdate.c.
static void catch_signal | ( | int | sig | ) | [static] |
static void log | ( | char * | str, | |
... | ||||
) | [static] |
Definition at line 211 of file sntpdate.c.
References as_daemon, buf, and stderr.
Referenced by hist__ioctl(), initCamera(), initSettings(), main(), and recorder().
Definition at line 239 of file sntpdate.c.
References as_daemon, catch_signal(), check_config, D, D2, D3, fd, ntp_stamp::frac, free(), log(), MAXNUMSERVERS, MAXRETRY, memcpy(), memset(), MILLION_D, MILLION_D_I, MILLION_L, NTP_SCALE_I, NTPDATE_FILE, NTPPORT, NTPTIMEOUT, read, ntpmsg::receive_stamp, ntp_stamp::sec, set_rtc_fpga(), TO_FRAC, ntpmsg::transmit_stamp, and UNIX_NTP_DIFF.
void set_rtc_fpga | ( | struct timeval * | ) |
Definition at line 800 of file sntpdate.c.
References FPGACONF_READREG, FPGACONF_WRITEREG, id, X313_WA_RTC_SEC, and X313_WA_RTC_USEC.
Referenced by main().
volatile int check_config = 0 [static] |
const ntp_double MILLION_D = 1.0e6 |
const ntp_double MILLION_D_I = 1.0e-6 |
const long MILLION_L = 1000000 |
const ntp_double NTP_SCALE = 4294967296.0 |
Definition at line 171 of file sntpdate.c.
const ntp_double NTP_SCALE_I = 2.3283064365e-10 |
const unsigned long UNIX_NTP_DIFF = 2208988800U |