~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2010-10-22 16:47:38 UTC
  • mfrom: (1841.1.7 drizzle_pbms)
  • Revision ID: kalebral@gmail.com-20101022164738-vv8w22b8towpb307
Merge Barry - fix bug 657830: PBMS build failure in GCC 4.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "CSConfig.h"
28
28
 
29
29
#include <string.h>
30
 
#include <time.h>
31
30
 
32
31
#ifdef OS_WINDOWS
33
32
#include <Windows.h>
 
33
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
 
34
#else
 
35
#include <sys/time.h>
34
36
#endif
35
37
 
36
38
#include "CSTime.h"
186
188
        setUTC(ltime.tm_year + 1900, ltime.tm_mon + 1, ltime.tm_mday, ltime.tm_hour, ltime.tm_min, ltime.tm_sec, nsec);
187
189
}
188
190
 
 
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
 
189
203
void CSTime::getUTC1970(time_t& sec, s_int& nsec)
190
204
{
191
205
#ifdef OS_WINDOWS
267
281
 
268
282
#endif
269
283
 
 
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
 
270
294