FS#12854 - ipod-time-sync sets wrong day

Attached to Project: Rockbox
Opened by sergio (sergio) - Monday, 15 April 2013, 14:37 GMT
Last edited by Bertrik Sikken (bertrik) - Friday, 17 May 2013, 19:16 GMT
Task Type Bugs
Category Drivers
Status Closed
Assigned To Bertrik Sikken (bertrik)
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.12
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Time sync works wrong for my sansa clipzip. It sets correct local time (hours, minutes, and seconds), correct year, and month, but wrong day. Today is 15 April but player shows 18 after synchronization.

I checked this with ipod-time-sync from libgpod-common 0.8.2-7 from debian sid and time-sync from trunk.
This task depends upon

Closed by  Bertrik Sikken (bertrik)
Friday, 17 May 2013, 19:16 GMT
Reason for closing:  Fixed
Additional comments about closing:  Tested and applied Boris' fix
Comment by asdsdaw (placerej) - Thursday, 02 May 2013, 15:00 GMT
I'm also having this problem on my iPod classic 160 gb with version 354c989-130424. After every sync with my PC it jumps forward a few days. I wouldn't care if it wasn't for the fact that my logs get all messed up, but now they do, so it's kind of annoying to always have to remember to set the date manually before you start listening.
Comment by Boris Gjenero (dreamlayers) - Wednesday, 15 May 2013, 15:49 GMT
This is because in yearday_to_daymonth(), the array of month lengths starts at 0, and the leap year determining code writes to index 2, giving March the length intended for February. Here's a fix.
Comment by sergio (sergio) - Friday, 17 May 2013, 09:16 GMT
Thank you, Boris.
I'd be happy to test it, but unfortunately I don't have time to rebuild.
Could you build it or say when this patch will be included in trunk so I can try daily build.