summaryrefslogtreecommitdiff
path: root/test/test-eel-pixbuf-scale.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-11-12 12:58:25 +0100
committerraveit65 <[email protected]>2020-11-24 22:28:30 +0100
commite991c05debb9a907ac5d17e17dba2b2c275632d3 (patch)
tree2d52efefc6ce80ae8f16b5f4110d3591e1b385d4 /test/test-eel-pixbuf-scale.c
parentc3b53c8c877536f04ea6de0aeea709833b90c94c (diff)
downloadcaja-e991c05debb9a907ac5d17e17dba2b2c275632d3.tar.bz2
caja-e991c05debb9a907ac5d17e17dba2b2c275632d3.tar.xz
Remove the use of the gettimeofday function
Diffstat (limited to 'test/test-eel-pixbuf-scale.c')
-rw-r--r--test/test-eel-pixbuf-scale.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/test/test-eel-pixbuf-scale.c b/test/test-eel-pixbuf-scale.c
index 481c4aa6..a46448b0 100644
--- a/test/test-eel-pixbuf-scale.c
+++ b/test/test-eel-pixbuf-scale.c
@@ -1,5 +1,3 @@
-#include <sys/time.h>
-
#include <eel/eel-gdk-pixbuf-extensions.h>
#include "test.h"
@@ -14,7 +12,7 @@ main (int argc, char* argv[])
{
GdkPixbuf *pixbuf, *scaled;
GError *error;
- struct timeval t1, t2;
+ gint64 t1, t2;
int i;
test_init (&argc, &argv);
@@ -36,35 +34,35 @@ main (int argc, char* argv[])
(double)gdk_pixbuf_get_width(pixbuf)/DEST_WIDTH,
(double)gdk_pixbuf_get_height(pixbuf)/DEST_HEIGHT);
- gettimeofday(&t1, NULL);
+ t1 = g_get_monotonic_time ();
for (i = 0; i < N_SCALES; i++) {
scaled = eel_gdk_pixbuf_scale_down (pixbuf, DEST_WIDTH, DEST_HEIGHT);
g_object_unref (scaled);
}
- gettimeofday(&t2, NULL);
- g_print ("Time for eel_gdk_pixbuf_scale_down: %ld msecs\n",
- (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec) / 1000);
+ t2 = g_get_monotonic_time ();
+ g_print ("Time for eel_gdk_pixbuf_scale_down: %" G_GINT64_FORMAT " msecs\n",
+ (t2 - t1) / G_TIME_SPAN_MILLISECOND);
- gettimeofday(&t1, NULL);
+ t1 = g_get_monotonic_time ();
for (i = 0; i < N_SCALES; i++) {
scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_NEAREST);
g_object_unref (scaled);
}
- gettimeofday(&t2, NULL);
- g_print ("Time for INTERP_NEAREST: %ld msecs\n",
- (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec) / 1000);
+ t2 = g_get_monotonic_time ();
+ g_print ("Time for INTERP_NEAREST: %" G_GINT64_FORMAT " msecs\n",
+ (t2 - t1) / G_TIME_SPAN_MILLISECOND);
- gettimeofday(&t1, NULL);
+ t1 = g_get_monotonic_time ();
for (i = 0; i < N_SCALES; i++) {
scaled = gdk_pixbuf_scale_simple (pixbuf, DEST_WIDTH, DEST_HEIGHT, GDK_INTERP_BILINEAR);
g_object_unref (scaled);
}
- gettimeofday(&t2, NULL);
- g_print ("Time for INTERP_BILINEAR: %ld msecs\n",
- (t2.tv_sec - t1.tv_sec) * 1000 + (t2.tv_usec - t1.tv_usec) / 1000);
+ t2 = g_get_monotonic_time ();
+ g_print ("Time for INTERP_BILINEAR: %" G_GINT64_FORMAT " msecs\n",
+ (t2 - t1) / G_TIME_SPAN_MILLISECOND);
scaled = eel_gdk_pixbuf_scale_down (pixbuf, DEST_WIDTH, DEST_HEIGHT);
gdk_pixbuf_save (scaled, "eel_scaled.png", "png", NULL, NULL);