apps/sntpdate/sntpdate.c File Reference

#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 Documentation

#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

Definition at line 106 of file sntpdate.c.

Referenced by main().

#define NTPDATE_FILE   "/etc/sntpdate.conf"

Definition at line 103 of file sntpdate.c.

Referenced by main().

#define NTPPORT   123

Definition at line 104 of file sntpdate.c.

Referenced by main().

#define NTPTIMEOUT   4

Definition at line 105 of file sntpdate.c.

Referenced by main().

#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))

Definition at line 202 of file sntpdate.c.

Referenced by main().

#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 Documentation

typedef double ntp_double

Definition at line 122 of file sntpdate.c.


Function Documentation

static void catch_signal ( int  sig  )  [static]

Definition at line 241 of file sntpdate.c.

References check_config.

Referenced by main().

static void log ( char *  str,
  ... 
) [static]

Definition at line 220 of file sntpdate.c.

References as_daemon, buf, and stderr.

Referenced by main().

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.


Variable Documentation

int as_daemon = 0 [static]

Definition at line 212 of file sntpdate.c.

Referenced by log(), and main().

volatile int check_config = 0 [static]

Definition at line 238 of file sntpdate.c.

Referenced by catch_signal(), and main().

const ntp_double MILLION_D = 1.0e6

Definition at line 182 of file sntpdate.c.

Referenced by main().

const ntp_double MILLION_D_I = 1.0e-6

Definition at line 183 of file sntpdate.c.

Referenced by main().

const long MILLION_L = 1000000

Definition at line 181 of file sntpdate.c.

Referenced by main().

const ntp_double NTP_SCALE = 4294967296.0

Definition at line 178 of file sntpdate.c.

const ntp_double NTP_SCALE_I = 2.3283064365e-10

Definition at line 179 of file sntpdate.c.

Referenced by main().

const unsigned long UNIX_NTP_DIFF = 2208988800U

Definition at line 172 of file sntpdate.c.

Referenced by main().


Generated on Fri Nov 28 00:07:23 2008 for elphel by  doxygen 1.5.1