Zeroing seconds with the Arduino Time library?

Hi, I have made a binary clock, which works fine. With two buttons you can set the time, that also works fine. What doesn't work fine is the zeroing of the seconds at the end of the "set time" process.

I am using the "Arduino Time library" and I want the seconds to be 00 when you have set the time so you can set it precise to the second.

My approach was this:

    //Set the seconds to zero
    time_t seconds = t % 60;
    t -= seconds;
    //Finally set the selected time
    setTime(t);

The variable "t" is the seconds since Jan 1 1970. First I tried Integer seconds but that didn't work either.

I hope I have made my problem understandable and you have some advice for me. :)

Have you tried the adjustTime function to lop off the seconds? Or used the setTime method with 6 arguments?

Tried it now. Didn't work. I have thrown in some print lines and now I am really confused:

//Set the seconds to zero
Serial.println(t);
int seconds = t % 60;
t -= seconds;
Serial.println(t);
//Finally set the selected time
setTime(t);
Serial.println(now());
Serial.println("----------");

This was the output:

62701
62700
62708
----------
62712
62700
62707
----------
62715
62700
62713
----------
62793
62760
62768
----------
62820
62820
62830
----------

It seems to add random seconds to the number. I hope this is my fault somewhere and not a bug in the library. By the way, the number is so small because I have set the date to the 1. 1. 1970 since my clock doesn't need the date.

Ok this works:

    //Set the seconds to zero
    setTime(t);
    int seconds = t % 60;
    t -= seconds;
    //Finally set the selected time
    setTime(t);

I have no idea why this works but it works. :-?