#include <sys/time.h>
#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 | SET_FPGA_TIME 0 |
#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 |
Typedefs | |
typedef double | ntp_double |
Functions | |
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 108 of file sntpdate.c.
#define D2 | ( | x | ) |
Definition at line 112 of file sntpdate.c.
#define D3 | ( | x | ) |
Definition at line 113 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 SET_FPGA_TIME 0 |
Definition at line 124 of file sntpdate.c.
#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 203 of file sntpdate.c.
#define USESYSLOG |
Definition at line 207 of file sntpdate.c.
typedef double ntp_double |
Definition at line 122 of file sntpdate.c.
static void catch_signal | ( | int | sig | ) | [static] |
static void log | ( | char * | str, | |
... | ||||
) | [static] |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 248 of file sntpdate.c.
References as_daemon, catch_signal(), check_config, D, D2, D3, exit, fd, ntp_stamp::frac, free(), log(), MAXNUMSERVERS, MAXRETRY, memcpy(), memset(), MILLION_D, MILLION_D_I, MILLION_L, n, NTP_SCALE_I, NTPDATE_FILE, NTPPORT, NTPTIMEOUT, read, ntpmsg::receive_stamp, ntp_stamp::sec, TO_FRAC, ntpmsg::transmit_stamp, UNIX_NTP_DIFF, and value.
int as_daemon = 0 [static] |
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 178 of file sntpdate.c.
const ntp_double NTP_SCALE_I = 2.3283064365e-10 |
const unsigned long UNIX_NTP_DIFF = 2208988800U |