Fri Apr 29 14:54:44 2005 Jonathan Blandford <jrb@redhat.com>

        * goo/GooTimer.h: New class to do simple timing checks.

        * glib/poppler-document.c: Patch from Martin Kretzschmar to really
        set the PDF version correct.  Third time's the charm.
parent 38948ea6
Fri Apr 29 14:54:44 2005 Jonathan Blandford <jrb@redhat.com>
* goo/GooTimer.h: New class to do simple timing checks.
* glib/poppler-document.c: Patch from Martin Kretzschmar to really
set the PDF version correct. Third time's the charm.
2005-04-29 Kristian Høgsberg <krh@bitplanet.net>
* configure.ac: Bump release to 0.3.1.
......
......@@ -303,7 +303,9 @@ poppler_document_get_property (GObject *object,
info_dict_get_string (obj.getDict(), "Title", value);
break;
case PROP_FORMAT:
str = g_strdup_printf ("PDF-%.2g", document->doc->getPDFVersion ());
str = g_strndup("PDF-", 15); /* allocates 16 chars, pads with \0s */
g_ascii_formatd (str + 4, 15 + 1 - 4,
"%.2g", document->doc->getPDFVersion ());
g_value_take_string (value, str);
break;
case PROP_AUTHOR:
......
//========================================================================
//
// GooTimer.cc
//
// Copyright 2005 Jonathan Blandford <jrb@redhat.com>
// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team
//
//========================================================================
#include <config.h>
#ifdef USE_GCC_PRAGMAS
#pragma implementation
#endif
#include <string.h>
#include "GooTimer.h"
//------------------------------------------------------------------------
// GooTimer
//------------------------------------------------------------------------
GooTimer::GooTimer() {
gettimeofday (&start, NULL);
active = true;
}
void
GooTimer::stop() {
gettimeofday (&end, NULL);
active = false;
}
#define USEC_PER_SEC 1000000
double
GooTimer::getElapsed ()
{
double total;
struct timeval elapsed;
if (active)
gettimeofday (&end, NULL);
if (start.tv_usec > end.tv_usec)
{
end.tv_usec += USEC_PER_SEC;
end.tv_sec--;
}
elapsed.tv_usec = end.tv_usec - start.tv_usec;
elapsed.tv_sec = end.tv_sec - start.tv_sec;
total = elapsed.tv_sec + ((double) elapsed.tv_usec / 1e6);
if (total < 0)
{
total = 0;
}
return total;
}
//========================================================================
//
// GooList.h
//
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================
#ifndef GOOTIMER_H
#define GOOTIMER_H
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "gtypes.h"
#include <sys/time.h>
//------------------------------------------------------------------------
// GooList
//------------------------------------------------------------------------
class GooTimer {
public:
// Create a new timer.
GooTimer();
void stop ();
double getElapsed();
private:
struct timeval start;
struct timeval end;
GBool active;
};
#endif
......@@ -4,6 +4,7 @@ poppler_goo_includedir = $(includedir)/poppler/goo
poppler_goo_include_HEADERS = \
GooHash.h \
GooList.h \
GooTimer.h \
GooMutex.h \
GooString.h \
gmem.h \
......@@ -16,5 +17,6 @@ libgoo_la_SOURCES = \
gmempp.cc \
GooHash.cc \
GooList.cc \
GooTimer.cc \
GooString.cc \
gmem.c
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment