GooTimer.h 1.35 KB
Newer Older
1 2
//========================================================================
//
3
// GooTimer.cc
4
//
5 6 7 8
// This file is licensed under GPLv2 or later
//
// Copyright 2005 Jonathan Blandford <jrb@redhat.com>
// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Albert Astals Cid's avatar
Albert Astals Cid committed
9
// Copyright 2010 Hib Eris <hib@hiberis.nl>
Albert Astals Cid's avatar
Albert Astals Cid committed
10
// Copyright 2011 Albert Astals cid <aacid@kde.org>
11 12
// Copyright 2014 Bogdan Cristea <cristeab@gmail.com>
// Copyright 2014 Peter Breitenlohner <peb@mppmu.mpg.de>
13
// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team
14 15 16 17 18 19 20 21 22 23
//
//========================================================================

#ifndef GOOTIMER_H
#define GOOTIMER_H

#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif

24
#include "poppler-config.h"
25
#include "gtypes.h"
26
#ifdef HAVE_GETTIMEOFDAY
27
#include <sys/time.h>
28 29
#endif

30
#ifdef _WIN32
31
#ifndef NOMINMAX
32
#define NOMINMAX
33
#endif
34 35
#include <windows.h>
#endif
36 37

//------------------------------------------------------------------------
38
// GooTimer
39 40 41 42 43 44 45 46
//------------------------------------------------------------------------

class GooTimer {
public:

  // Create a new timer.
  GooTimer();

47 48
  void start();
  void stop();
49 50 51
  double getElapsed();

private:
52 53 54
#ifdef HAVE_GETTIMEOFDAY
  struct timeval start_time;
  struct timeval end_time;
55
#elif defined(_WIN32)
56 57
  LARGE_INTEGER start_time;
  LARGE_INTEGER end_time;
58
#endif
59 60
  GBool active;
};
61 62

#endif