~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.cc

  • Committer: Lee Bieber
  • Date: 2011-01-12 02:31:03 UTC
  • mfrom: (2068.7.5 session-fix)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: kalebral@gmail.com-20110112023103-nmz26cv1j32jc6n3
Merge Brian - fix bug 527084 - DROP TABLE: getTableDefiniton returns EEXIST but doDropTable returns ENOENT leads to SIGSEGV

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "drizzled/time_functions.h"
45
45
#include "time.h"
46
46
 
47
 
#include <drizzled/util/gmtime.h>
48
 
 
49
47
#include <time.h>
50
48
 
51
49
#include <cstdio>
61
59
extern std::vector<TemporalFormat *> known_date_formats;
62
60
extern std::vector<TemporalFormat *> known_time_formats;
63
61
 
64
 
Temporal::Temporal() :
65
 
  _calendar(GREGORIAN),
66
 
  _years(0),
67
 
  _months(0),
68
 
  _days(0),
69
 
  _hours(0),
70
 
  _minutes(0),
71
 
  _seconds(0),
72
 
  _epoch_seconds(0),
73
 
  _useconds(0),
74
 
  _nseconds(0),
75
 
  _overflow(false)
 
62
Temporal::Temporal()
 
63
:
 
64
  _calendar(GREGORIAN)
 
65
, _years(0)
 
66
, _months(0)
 
67
, _days(0)
 
68
, _hours(0)
 
69
, _minutes(0)
 
70
, _seconds(0)
 
71
, _epoch_seconds(0)
 
72
, _useconds(0)
 
73
, _nseconds(0)
 
74
, _overflow(false)
76
75
{}
77
76
 
78
77
uint64_t Temporal::_cumulative_seconds_in_time() const
101
100
        }
102
101
        
103
102
        // Get the gmtime based on the local seconds since the Epoch
104
 
        gm_time = util::gmtime(local_secs, &gm__rec);
 
103
        gm_time = gmtime_r(&local_secs, &gm__rec);
105
104
        gm_time->tm_isdst = 0;
106
105
        
107
106
        // Interpret gmtime as the local time and convert it to seconds since the Epoch
1291
1290
  struct tm broken_time;
1292
1291
  struct tm *result;
1293
1292
 
1294
 
  result= util::gmtime(from, &broken_time);
 
1293
  result= gmtime_r(&from, &broken_time);
1295
1294
  if (result != NULL)
1296
1295
  {
1297
1296
    _years= 0;
1315
1314
  struct tm broken_time;
1316
1315
  struct tm *result;
1317
1316
 
1318
 
  result= util::gmtime(from, &broken_time);
 
1317
  result= gmtime_r(&from, &broken_time);
1319
1318
  if (result != NULL)
1320
1319
  {
1321
1320
    _years= 1900 + broken_time.tm_year;
1339
1338
  struct tm broken_time;
1340
1339
  struct tm *result;
1341
1340
 
1342
 
  result= util::gmtime(timeval_arg.tv_sec, &broken_time);
 
1341
  result= gmtime_r(&timeval_arg.tv_sec, &broken_time);
1343
1342
  if (result != NULL)
1344
1343
  {
1345
1344
    _years= 1900 + broken_time.tm_year;
1365
1364
  struct tm broken_time;
1366
1365
  struct tm *result;
1367
1366
 
1368
 
  result= util::gmtime(from, &broken_time);
 
1367
  result= gmtime_r(&from, &broken_time);
1369
1368
  if (result != NULL)
1370
1369
  {
1371
1370
    _years= 1900 + broken_time.tm_year;