public
Description: A simple ntp library for arduino
Homepage:
Clone URL: git://github.com/cynshard/arduino-ntp.git
arduino-ntp / NTP.h
100644 42 lines (37 sloc) 1.002 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef NTP_h
#define NTP_h
 
#include "WProgram.h"
#include <UdpBytewise.h>
 
class NTP
{
    public:
        NTP(byte address[]);
        ~NTP();
        unsigned long get_gmt();
        unsigned long get_unix_gmt();
        unsigned long get_unix_tz(int offset);
    private:
        byte _address[4];
        int _leap_indicator;
        int _version;
        int _mode;
        int _stratum;
        int _polling_interval;
        int _precision;
        float _delay_interval;
        float _dispersion;
        byte _ref_clock_id[4];
        unsigned long _ref_clock_update_time;
        unsigned long _orig_timestamp;
        unsigned long _recv_timestamp;
        unsigned long _send_timestamp;
 
        int send_ntp_packet();
        unsigned long get_ulong();
        unsigned long get_time_discard_precision();
        void write_n(int what, int how_many);
        int get_leap_indicator(byte b);
        int get_version(byte b);
        int get_mode(byte b);
        void call();
};
 
#endif