diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-08-04 09:15:08 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-08-04 09:15:08 +0000 |
commit | 59cee0067712d3c0bcebc8795e6b5709c1e8c15d (patch) | |
tree | 38f3637f0ff4d83982af248dcf0093cafae2aeaa /src/mh.c | |
parent | 2576b08989a3361f1da272085840bda30cac9f5d (diff) |
improved portability.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@461 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/mh.c')
-rw-r--r-- | src/mh.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -27,15 +27,12 @@ #include <glib/gi18n.h> #include <dirent.h> #include <sys/stat.h> +#include <time.h> #include <unistd.h> #include <string.h> #include <errno.h> -#undef MEASURE_TIME - -#ifdef MEASURE_TIME -# include <sys/time.h> -#endif +#define MEASURE_TIME #include "folder.h" #include "mh.h" @@ -197,13 +194,15 @@ static GSList *mh_get_msg_list(Folder *folder, FolderItem *item, GHashTable *msg_table; time_t cur_mtime; #ifdef MEASURE_TIME - struct timeval tv_before, tv_after, tv_result; - - gettimeofday(&tv_before, NULL); + GTimer *timer; #endif g_return_val_if_fail(item != NULL, NULL); +#ifdef MEASURE_TIME + timer = g_timer_new(); +#endif + cur_mtime = mh_get_mtime(item); if (use_cache && item->mtime == cur_mtime) { @@ -257,11 +256,10 @@ static GSList *mh_get_msg_list(Folder *folder, FolderItem *item, mlist = procmsg_sort_msg_list(mlist, item->sort_key, item->sort_type); #ifdef MEASURE_TIME - gettimeofday(&tv_after, NULL); - - timersub(&tv_after, &tv_before, &tv_result); - g_print("mh_get_msg_list: %s: elapsed time: %ld.%06ld sec\n", - item->path, tv_result.tv_sec, tv_result.tv_usec); + g_timer_stop(timer); + g_print("%s: %s: elapsed time: %f sec\n", + G_STRFUNC, item->path, g_timer_elapsed(timer, NULL)); + g_timer_destroy(timer); #endif debug_print("cache_dirty: %d, mark_dirty: %d\n", item->cache_dirty, item->mark_dirty); |