~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal.cc

  • Committer: Brian Aker
  • Date: 2010-08-18 19:37:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1720.
  • Revision ID: brian@tangent.org-20100818193719-bxxzn1pi22styowd
created function that can be used to simply crash the server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
      + _seconds);
82
82
}
83
83
 
84
 
#if defined(TARGET_OS_SOLARIS)
85
 
/* @TODO: Replace this with Boost.DateTime */
86
 
static time_t timegm(struct tm *my_time)
87
 
{
88
 
        time_t local_secs, gm_secs;
89
 
        struct tm gm__rec, *gm_time;
90
 
 
91
 
        // Interpret 't' as the local time and convert it to seconds since the Epoch
92
 
        local_secs = mktime(my_time);
93
 
        if (local_secs == -1)
94
 
  {
95
 
                my_time->tm_hour--;
96
 
                local_secs = mktime (my_time);
97
 
                if (local_secs == -1)
98
 
                        return -1; 
99
 
                local_secs += 3600;
100
 
        }
101
 
        
102
 
        // Get the gmtime based on the local seconds since the Epoch
103
 
        gm_time = gmtime_r(&local_secs, &gm__rec);
104
 
        gm_time->tm_isdst = 0;
105
 
        
106
 
        // Interpret gmtime as the local time and convert it to seconds since the Epoch
107
 
        gm_secs = mktime (gm_time);
108
 
        if (gm_secs == -1)
109
 
  {
110
 
                gm_time->tm_hour--;
111
 
                gm_secs = mktime (gm_time);
112
 
                if (gm_secs == -1)
113
 
                        return -1; 
114
 
                gm_secs += 3600;
115
 
        }
116
 
        
117
 
        // Return the local time adjusted by the difference from GM time.
118
 
        return (local_secs - (gm_secs - local_secs));
119
 
}
120
 
#endif
121
 
 
122
84
void Temporal::set_epoch_seconds()
123
85
{
124
86
  /* 
1405
1367
bool Timestamp::is_valid() const
1406
1368
{
1407
1369
  return DateTime::is_valid() 
1408
 
      && in_unix_epoch_range(_years, _months, _days, _hours, _minutes, _seconds)
1409
 
      && (_seconds <= 59);
 
1370
      && in_unix_epoch_range(_years, _months, _days, _hours, _minutes, _seconds);
1410
1371
}
1411
1372
 
1412
1373
bool MicroTimestamp::is_valid() const