# HG changeset patch # User Adam Chlipala # Date 1247865263 14400 # Node ID ba3569f4fe89295399d6ac25172957cf8ce8e803 # Parent 9eb479691d1ce88b9d5f096e10d5136e92eea384 Fix month off-by-one for MySQL timestamps diff -r 9eb479691d1c -r ba3569f4fe89 src/mysql.sml --- a/src/mysql.sml Fri Jul 17 17:09:55 2009 -0400 +++ b/src/mysql.sml Fri Jul 17 17:14:23 2009 -0400 @@ -666,7 +666,7 @@ string ";", newline, newline, - string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month, mt->year, 0, 0, -1};", + string "struct tm t = {mt->second, mt->minute, mt->hour, mt->day, mt->month-1, mt->year, 0, 0, -1};", newline, string "mktime(&t);", newline, @@ -1046,7 +1046,10 @@ string ": error converting to MySQL time\");", newline, oneField "year" "year", - oneField "month" "mon", + box [string "in_buffer", + string (Int.toString i), + string ".month = tms.tm_mon + 1;", + newline], oneField "day" "mday", oneField "hour" "hour", oneField "minute" "min",