Question on RTCLib

I have two questions on the RTCLib (from Arduino libraries, by Adafruit v 1.2.0).

  1. In the RTCLib.cpp is defined a PROGMEM array called daysinmonth. I also need the days in a month else where in the program. How do I get access to this instance, rather than (re)defining my own?

  2. What does this function do

DateTime::DateTime (const DateTime& copy):
  yOff(copy.yOff),
  m(copy.m),
  d(copy.d),
  hh(copy.hh),
  mm(copy.mm),
  ss(copy.ss)
{}

and how does it do it?

adwsystems:
2. What does this function do

DateTime::DateTime (const DateTime& copy):

yOff(copy.yOff),
  m(copy.m),
  d(copy.d),
  hh(copy.hh),
  mm(copy.mm),
  ss(copy.ss)
{}



and how does it do it?

That is a constructor for the DateTime class with member initialization. You can get an explanation here:
http://www.cplusplus.com/doc/tutorial/classes/#member_initialization

pert:
That is a constructor for the DateTime class with member initialization. You can get an explanation here:
http://www.cplusplus.com/doc/tutorial/classes/#member_initialization

OK. But what it is doing? ie., what the heck is yOff(copy.yOff)?

Thoughts on question #1?

adwsystems:
I have two questions on the RTCLib (from Arduino libraries, by Adafruit v 1.2.0).

  1. In the RTCLib.cpp is defined a PROGMEM array called daysinmonth. I also need the days in a month else where in the program. How do I get access to this instance, rather than (re)defining my own?

EDIT:
You'd have to add: 'extern const uint8_t daysInMonth[];' to both RTClib.h and your .ino file.

gfvalvo:
EDIT:
You'd have to add: 'extern const uint8_t daysInMonth[];' to both RTClib.h and your .ino file.

Has to be in the RTC file? Darn! I hate modifying libraries (that aren't mine). Thanks for the info.

adwsystems:
OK. But what it is doing?

Constructing an object of the DateTime class via a copy constructor.

ie., what the heck is yOff(copy.yOff)?

Part of an initialization list. It sets the yOff member of the newly constructed object equal to the yOff member of the object that is being copied.

I think you can see an example of the copy constructor in use in the datecalc example:

See how they're copying one DateTime object to another?

An explanation of why it was necessary to define the copy constructor in this case instead of using the implicit one automatically provided by the compiler: