WTF? Can't convert an int to an int?

I'm getting an error trying to "convert" a uint8_t to a uint8_t. What the heck?!?! I'm just copying one to the other. The error is: cannot convert 'DateTime::second' from type 'uint8_t (DateTime::)()const {aka unsigned char (DateTime::)()const}' to type 'uint8_t {aka unsigned char} :uint8_t s = RTCtime.second The error repeats again for minute, hour, day, month, and year.

The 2 lines in question are:

DateTime RTCtime =;
now.setTime(RTCtime.second, RTCtime.minute, RTCtime.hour,, RTCtime.month, RTCtime.year);

The context is I'm trying to set a time[like] class object to the correct time from a DS1307 Real-Time-Clock module.

The first line is getting a DateTime object from the RTClib library. The DateTime object is defined in that library as:

// Simple general-purpose date/time class (no TZ / DST / leap second handling!)
class DateTime {
    DateTime (uint32_t t =0);
    DateTime (uint16_t year, uint8_t month, uint8_t day,
                uint8_t hour =0, uint8_t min =0, uint8_t sec =0);
    DateTime (const DateTime& copy);
    DateTime (const char* date, const char* time);
    DateTime (const __FlashStringHelper* date, const __FlashStringHelper* time);
    uint16_t year() const       { return 2000 + yOff; }
    uint8_t month() const       { return m; }
    uint8_t day() const         { return d; }
    uint8_t hour() const        { return hh; }
    uint8_t minute() const      { return mm; }
    uint8_t second() const      { return ss; }
    uint8_t dayOfTheWeek() const;

    // 32-bit times as seconds since 1/1/2000
    long secondstime() const;   
    // 32-bit times as seconds since 1/1/1970
    uint32_t unixtime(void) const;

    DateTime operator+(const TimeSpan& span);
    DateTime operator-(const TimeSpan& span);
    TimeSpan operator-(const DateTime& right);

    uint8_t yOff, m, d, hh, mm, ss;

The second line attempts to set my time object, and that's where the error occurs. Note that this is NOT the standard time class, but one of my own creation which works very similar**. The set procedure is defined as:

void time_t::setTime(uint8_t seconds, uint8_t minutes, uint8_t hours, uint8_t days, uint8_t months, uint16_t years) {

I'm guessing this is because of the 'const' in the DateTime class of the RTClib. But I've tried all sorts of ways to get around it including:

now.setTime((uint8_t)RTCtime.second, (uint8_t)RTCtime.minute, (uint8_t)RTCtime.hour, (uint8_t), (uint8_t)RTCtime.month, (uint16_t)RTCtime.year);
// or
uint8_t s = RTCtime.second;
uint8_t m = RTCtime.minute;
uint8_t h = RTCtime.hour;
uint8_t d =;
uint8_t n = RTCtime.month;
uint16_t y = RTCtime.year;
now.setTime(s, m, h, d, n, y);

So am I correct that it is because of the 'const' in the library? How do I work around this without modifying the library? Why is the const causing trouble? - I'm not trying to modify that one.

** The standard time class stores the time internally in unix time (# of second since midnight, 1970) and has to be divided out every time you need the hours, minutes, seconds, etc. Not very efficient when you are constantly querying it to update a display. My version stores hours, minutes, seconds, etc. all separately. Also, mine has 1/10 second accuracy (or millisecond accuracy on faster platforms)

I just call breakTime() once before a long series of field queries, rather than using now.hour() etc. if there are a significant number of them, as recommended in the Time documentation ( I think ).

But if you're using the Time library, you should just set the RTC as the sync provider. Then you wouldn't have to be copying the RTC time to now(), which is kind of bent.

You are not "converting" uint8_t to uint8_t. You are converting uint8_t (DateTime::)()const to uint8_t

In other words, RTCtime.second, RTCtime.minute, etc are functions, not numbers.

now.setTime(RTCtime.second(), RTCtime.minute(), RTCtime.hour(),, RTCtime.month(), RTCtime.year());

Duh. Shoulda seen that, I feel stupid. Thanks oqibidipo!