Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50625 Library:50543 in /sites/rockbox.org/flyspray/adodb/drivers/adodb-mysqli.inc.php on line 108 FS#7849 : set_time() uses rtc_write_time() incorrectly



FS#7849 - set_time() uses rtc_write_time() incorrectly

Attached to Project: Rockbox
Opened by Victor Rajewski (vik) - Friday, 28 September 2007, 00:57 GMT
Last edited by Bertrik Sikken (bertrik) - Tuesday, 15 April 2008, 18:34 GMT
Task Type Bugs
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


set_time() in timefuncs.c expects rtc_write_time() to return 0 on success. However, all rtc_write_time() functions return 1 always (no error checking is done). So set_time() always returns a failure even if clock was set correctly.
This task depends upon

Closed by  Bertrik Sikken (bertrik)
Tuesday, 15 April 2008, 18:34 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in 17123
Comment by Bertrik Sikken (bertrik) - Thursday, 25 October 2007, 20:27 GMT
As far as I can see you're right, but nobody's checking the result of set_time() currently.
Attached is a patch that should fix it.
Comment by Bertrik Sikken (bertrik) - Monday, 14 April 2008, 20:19 GMT
On second thought, the situation is a little more complicated. Depending on the hardware driver, function rtc_write_datetime returns various values, for example the as3514 driver returns 1, the uisim stub returns 0 and the ds1339 driver returns the return value of a call to sw_i2c_write (which itself returns <0 on error and 0 if things are OK).

A common rule to be derived from this, is that <0 means error and >= 0 means OK. Attached is a patch that evaluates the return value like this.