From 0aa6c3a15541d012d2ab10034090490fc2a2d1ca Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 6 Aug 2004 18:20:08 +0000 Subject: [PATCH] add LTT_TIME_MAX and LTT_TIME_MIN git-svn-id: http://ltt.polymtl.ca/svn@669 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/time.h | 9 ++++++--- .../lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c | 3 +-- .../lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h | 8 ++++---- .../modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ltt/branches/poly/ltt/time.h b/ltt/branches/poly/ltt/time.h index d961f373..d9049530 100644 --- a/ltt/branches/poly/ltt/time.h +++ b/ltt/branches/poly/ltt/time.h @@ -28,13 +28,13 @@ typedef struct _LttTime { } LttTime; -static const unsigned long NANOSECONDS_PER_SECOND = 1000000000; +#define NANOSECONDS_PER_SECOND 1000000000 -static const LttTime ltt_time_zero = { 0, 0}; +static const LttTime ltt_time_zero = { 0, 0 }; static const LttTime ltt_time_one = { 0, 1 }; -static const LttTime ltt_time_infinite = { G_MAXUINT, G_MAXUINT }; +static const LttTime ltt_time_infinite = { G_MAXUINT, NANOSECONDS_PER_SECOND }; static inline LttTime ltt_time_sub(LttTime t1, LttTime t2) { @@ -110,6 +110,9 @@ static inline int ltt_time_compare(LttTime t1, LttTime t2) return 0; } +#define LTT_TIME_MIN(a,b) ((ltt_time_compare((a),(b)) < 0) ? (a) : (b)) +#define LTT_TIME_MAX(a,b) ((ltt_time_compare((a),(b)) > 0) ? (a) : (b)) + #define MAX_TV_SEC_TO_DOUBLE 0x7FFFFF static inline double ltt_time_to_double(LttTime t1) { diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index c101c9c6..4ec7864f 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -1283,8 +1283,7 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) lttv_traceset_context_position_save(tsc, events_request->start_position); /* 1.2. Remove start time */ - events_request->start_time.tv_sec = G_MAXUINT; - events_request->start_time.tv_nsec = G_MAXUINT; + events_request->start_time = ltt_time_infinite; /* 1.3. Move from list_in to list_out */ remove = TRUE; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index 28033ed4..b4dea0e7 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -602,15 +602,15 @@ void lttvwindow_report_focus(Tab *tab, /* Structure sent to the events request hook */ - /* Value considered as empty */ + /* Value considered as empty*/ typedef struct _EventsRequest { gpointer owner; /* Owner of the request */ gpointer viewer_data; /* Unset : NULL */ - gboolean servicing; /* service in progress: TRUE */ - LttTime start_time;/* Unset : { G_MAXUINT, G_MAXUINT }*/ + gboolean servicing; /* service in progress: TRUE*/ + LttTime start_time; /* Unset : ltt_time_infinite*/ LttvTracesetContextPosition *start_position; /* Unset : NULL */ gboolean stop_flag; /* Continue:TRUE Stop:FALSE */ - LttTime end_time;/* Unset : { G_MAXUINT, G_MAXUINT } */ + LttTime end_time; /* Unset : ltt_time_infinite*/ guint num_events; /* Unset : G_MAXUINT */ LttvTracesetContextPosition *end_position; /* Unset : NULL */ LttvHooks *before_chunk_traceset; /* Unset : NULL */ diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index 5b34c8c5..05c24b7a 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -1024,7 +1024,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) /* 2. call process traceset middle for a chunk */ { /*(assert list_in is not empty! : should not even be called in that case)*/ - LttTime end = { G_MAXUINT, G_MAXUINT }; + LttTime end = ltt_time_infinite; g_assert(g_slist_length(*list_in) != 0); lttv_process_traceset_middle(tsc, end, CHUNK_NUM_EVENTS, NULL); -- 2.34.1