[Groonga-mysql-commit] mroonga/mroonga [master] Use 1970-01-01 00:00:00 for time that can't be handled by mktime()

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Oct 24 18:45:33 JST 2012


Kouhei Sutou	2012-10-24 18:45:33 +0900 (Wed, 24 Oct 2012)

  New Revision: 8a10500dcdfa3ef33ef0c7ae3fe40621b96bfb6a
  https://github.com/mroonga/mroonga/commit/8a10500dcdfa3ef33ef0c7ae3fe40621b96bfb6a

  Log:
    Use 1970-01-01 00:00:00 for time that can't be handled by mktime()
    
    refs #1476

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+7 -2)
===================================================================
--- ha_mroonga.cpp    2012-10-24 16:11:45 +0900 (53be5b8)
+++ ha_mroonga.cpp    2012-10-24 18:45:33 +0900 (aefb05f)
@@ -1505,8 +1505,13 @@ static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf,
 static long long int mrn_tm_to_grn_time(struct tm *time, int usec)
 {
   MRN_DBUG_ENTER_FUNCTION();
-  long long int sec = mktime(time) + mrn_utc_diff_in_seconds;
-  long long int grn_time = GRN_TIME_PACK(sec, usec);
+  long long int grn_time;
+  long long int sec = mktime(time);
+  if (sec == -1) {
+    grn_time = 0;
+  } else {
+    grn_time = GRN_TIME_PACK(sec + mrn_utc_diff_in_seconds, usec);
+  }
   DBUG_RETURN(grn_time);
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index