changeset 888:ba3569f4fe89

Fix month off-by-one for MySQL timestamps
author Adam Chlipala <adamc@hcoop.net>
date Fri, 17 Jul 2009 17:14:23 -0400
parents 9eb479691d1c
children bcad392e288e
files src/mysql.sml
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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",