~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.cc

  • Committer: Brian Aker
  • Date: 2011-01-17 06:29:39 UTC
  • mto: (2097.1.1 drizzle-build)
  • mto: This revision was merged to the branch mainline in revision 2098.
  • Revision ID: brian@tangent.org-20110117062939-d4ldbka3oycdzv78
Stype cleanup, also have session now return epoch_t

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
 
47
49
#include <time.h>
48
50
 
49
51
#include <cstdio>
59
61
extern std::vector<TemporalFormat *> known_date_formats;
60
62
extern std::vector<TemporalFormat *> known_time_formats;
61
63
 
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)
 
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)
75
76
{}
76
77
 
77
78
uint64_t Temporal::_cumulative_seconds_in_time() const
100
101
        }
101
102
        
102
103
        // Get the gmtime based on the local seconds since the Epoch
103
 
        gm_time = gmtime_r(&local_secs, &gm__rec);
 
104
        gm_time = util::gmtime(local_secs, &gm__rec);
104
105
        gm_time->tm_isdst = 0;
105
106
        
106
107
        // Interpret gmtime as the local time and convert it to seconds since the Epoch
1290
1291
  struct tm broken_time;
1291
1292
  struct tm *result;
1292
1293
 
1293
 
  result= gmtime_r(&from, &broken_time);
 
1294
  result= util::gmtime(from, &broken_time);
1294
1295
  if (result != NULL)
1295
1296
  {
1296
1297
    _years= 0;
1314
1315
  struct tm broken_time;
1315
1316
  struct tm *result;
1316
1317
 
1317
 
  result= gmtime_r(&from, &broken_time);
 
1318
  result= util::gmtime(from, &broken_time);
1318
1319
  if (result != NULL)
1319
1320
  {
1320
1321
    _years= 1900 + broken_time.tm_year;
1338
1339
  struct tm broken_time;
1339
1340
  struct tm *result;
1340
1341
 
1341
 
  result= gmtime_r(&timeval_arg.tv_sec, &broken_time);
 
1342
  result= util::gmtime(timeval_arg.tv_sec, &broken_time);
1342
1343
  if (result != NULL)
1343
1344
  {
1344
1345
    _years= 1900 + broken_time.tm_year;
1364
1365
  struct tm broken_time;
1365
1366
  struct tm *result;
1366
1367
 
1367
 
  result= gmtime_r(&from, &broken_time);
 
1368
  result= util::gmtime(from, &broken_time);
1368
1369
  if (result != NULL)
1369
1370
  {
1370
1371
    _years= 1900 + broken_time.tm_year;