~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

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
 *
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * Original author: Paul McCullagh (H&G2JCtL)
20
20
 * Continued development: Barry Leslie
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