~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSTime.cc

  • Committer: lbieber
  • Date: 2010-10-05 22:23:12 UTC
  • mfrom: (1813.1.4 build)
  • Revision ID: lbieber@orisndriz08-20101005222312-weuq0ardk3gcryau
Merge Travis - 621861 - convert structs to classes
Merge Billy - 621331 - Replace use of stringstream with boost::lexical_cast
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle
Merge Andrew - fix bug 653300 - Syntax error on inport of a SQL file produced by drizzledump

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
 
1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
2
2
 *
3
3
 * PrimeBase Media Stream for MySQL
4
4
 *
27
27
#include "CSConfig.h"
28
28
 
29
29
#include <string.h>
 
30
#include <time.h>
30
31
 
31
32
#ifdef OS_WINDOWS
32
33
#include <Windows.h>
33
 
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
34
 
#else
35
 
#include <sys/time.h>
36
34
#endif
37
35
 
38
36
#include "CSTime.h"
188
186
        setUTC(ltime.tm_year + 1900, ltime.tm_mon + 1, ltime.tm_mday, ltime.tm_hour, ltime.tm_min, ltime.tm_sec, nsec);
189
187
}
190
188
 
191
 
bool CSTime::olderThen(time_t max_age)
192
 
{
193
 
        time_t secs, now;
194
 
        s_int nsec;
195
 
        
196
 
        getUTC1970(secs, nsec);
197
 
        
198
 
        now = time(NULL);
199
 
        
200
 
        return ((now - secs) > max_age);
201
 
}
202
 
 
203
189
void CSTime::getUTC1970(time_t& sec, s_int& nsec)
204
190
{
205
191
#ifdef OS_WINDOWS
281
267
 
282
268
#endif
283
269
 
284
 
uint64_t CSTime::getTimeCurrentTicks()
285
 
{
286
 
        struct timeval  now;
287
 
 
288
 
        /* Get the current time in microseconds: */
289
 
        gettimeofday(&now, NULL);
290
 
        return (uint64_t) now.tv_sec * (uint64_t) 1000000 + (uint64_t) now.tv_usec;
291
 
}
292
 
 
293
 
 
294
270