~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/type/uuid.h

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
#include <cstdio>
68
68
#include <iosfwd>
69
69
 
70
 
namespace drizzled
71
 
{
72
 
namespace type
73
 
{
 
70
namespace drizzled {
 
71
namespace type {
74
72
 
75
 
class Uuid {
 
73
class Uuid 
 
74
{
76
75
        uint32_t        time_low;
77
76
        uint16_t        time_mid;
78
77
        uint16_t        time_hi_and_version;
188
187
    return false;
189
188
  }
190
189
 
191
 
  void unparse(char *out)
 
190
  void unparse(char *out) const
192
191
  {
193
192
    snprintf(out, DISPLAY_BUFFER_LENGTH, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
194
193
            time_low,
204
203
            node[5]);
205
204
  }
206
205
 
207
 
  void time(struct timeval& ret_val)
 
206
  void time(timeval& ret_val) const
208
207
  {
209
208
    uint32_t high;
210
209
    uint64_t clock_reg;
216
215
    ret_val.tv_sec = clock_reg / 10000000;
217
216
    ret_val.tv_usec = (clock_reg % 10000000) / 10;
218
217
  }
219
 
  bool isTimeType()
 
218
  bool isTimeType() const
220
219
  {
221
 
    return ((time_hi_and_version >> 12) & 0xF) == 1 ? true : false; 
 
220
    return ((time_hi_and_version >> 12) & 0xF) == 1; 
222
221
  }
223
222
 
224
223
  static const size_t LENGTH= 16;