mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Update Mroonga to the latest version on 2015-07-02T04:12:21+0900
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* -*- c-basic-offset: 2 -*- */
|
||||
/*
|
||||
Copyright(C) 2010-2013 Kentoku SHIBA
|
||||
Copyright(C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
|
||||
Copyright(C) 2011-2015 Kouhei Sutou <kou@clear-code.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@@ -18,10 +18,6 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "mrn_time_converter.hpp"
|
||||
|
||||
#ifdef min
|
||||
@@ -257,4 +253,43 @@ namespace mrn {
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
long long int TimeConverter::mysql_datetime_to_grn_time(long long int mysql_datetime,
|
||||
bool *truncated) {
|
||||
MRN_DBUG_ENTER_METHOD();
|
||||
|
||||
MYSQL_TIME mysql_time;
|
||||
mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
||||
mysql_time.neg = 0;
|
||||
mysql_time.second_part = 0;
|
||||
mysql_time.second = (mysql_datetime % 100);
|
||||
mysql_time.minute = (mysql_datetime / 100 % 100);
|
||||
mysql_time.hour = (mysql_datetime / 10000 % 100);
|
||||
mysql_time.day = (mysql_datetime / 1000000 % 100);
|
||||
mysql_time.month = (mysql_datetime / 100000000 % 100);
|
||||
mysql_time.year = (mysql_datetime / 10000000000LL % 10000);
|
||||
|
||||
long long int grn_time = mysql_time_to_grn_time(&mysql_time, truncated);
|
||||
|
||||
DBUG_RETURN(grn_time);
|
||||
}
|
||||
|
||||
long long int TimeConverter::grn_time_to_mysql_datetime(long long int grn_time) {
|
||||
MRN_DBUG_ENTER_METHOD();
|
||||
|
||||
MYSQL_TIME mysql_time;
|
||||
mysql_time.time_type = MYSQL_TIMESTAMP_DATETIME;
|
||||
|
||||
grn_time_to_mysql_time(grn_time, &mysql_time);
|
||||
|
||||
long long int mysql_datetime =
|
||||
(mysql_time.second * 1) +
|
||||
(mysql_time.minute * 100) +
|
||||
(mysql_time.hour * 10000) +
|
||||
(mysql_time.day * 1000000) +
|
||||
(mysql_time.month * 100000000) +
|
||||
(mysql_time.year * 10000000000LL);
|
||||
|
||||
DBUG_RETURN(mysql_datetime);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user