Go Down

Topic: Making a library for a NTP - timeserver request (Read 1 time) previous topic - next topic

PaulS

Code: [Select]
NTP::NTP():

  char ntpServer[]("0.ch.pool.ntp.org"),
  int NTP_PACKET_SIZE (48);
{
  DNSClient DNS;
  EthernetUDP Udp;
}

Local variables that go out of scope when the constructor ends don't seem all that useful.

Why are they not class members?

Where does timeServer get assigned a value?

The global declaration of NTP_PACKET_SIZE and the class member NTP_PACKET_SIZE are not the same variable. Which one has precedence in a class method? The global declaration of ntpServer and the class member ntpServer are not the same variable.

Declaring an array of size NTP_PACKET_SIZE in the header, when the size is the default value of 0, doesn't seem all that useful. It's probably just as well that you never try to initialize the 0 element class member array ntpServer.

Go Up