"Fossies" - the Fresh Open Source Software Archive

Member "poppler-0.82.0/goo/GooTimer.h" (25 Oct 2019, 1309 Bytes) of package /linux/misc/poppler-0.82.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "GooTimer.h" see the Fossies "Dox" file reference documentation.

    1 //========================================================================
    2 //
    3 // GooTimer.cc
    4 //
    5 // This file is licensed under GPLv2 or later
    6 //
    7 // Copyright 2005 Jonathan Blandford <jrb@redhat.com>
    8 // Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
    9 // Copyright 2010 Hib Eris <hib@hiberis.nl>
   10 // Copyright 2011 Albert Astals cid <aacid@kde.org>
   11 // Copyright 2014 Bogdan Cristea <cristeab@gmail.com>
   12 // 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 #ifndef GOOTIMER_H
   18 #define GOOTIMER_H
   19 
   20 #include "poppler-config.h"
   21 #ifdef HAVE_GETTIMEOFDAY
   22 #include <sys/time.h>
   23 #endif
   24 
   25 #ifdef _WIN32
   26 #ifndef NOMINMAX
   27 #define NOMINMAX
   28 #endif
   29 #include <windows.h>
   30 #endif
   31 
   32 //------------------------------------------------------------------------
   33 // GooTimer
   34 //------------------------------------------------------------------------
   35 
   36 class GooTimer {
   37 public:
   38 
   39   // Create a new timer.
   40   GooTimer();
   41 
   42   void start();
   43   void stop();
   44   double getElapsed();
   45 
   46 private:
   47 #ifdef HAVE_GETTIMEOFDAY
   48   struct timeval start_time;
   49   struct timeval end_time;
   50 #elif defined(_WIN32)
   51   LARGE_INTEGER start_time;
   52   LARGE_INTEGER end_time;
   53 #endif
   54   bool active;
   55 };
   56 
   57 #endif