From: Zdeněk Salvet Date: Thu, 18 May 2006 09:44:56 +0000 (+0000) Subject: Sort events with identical sequence code according to their timestamps. X-Git-Tag: glite-lb-server_R_1_3_8~1 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=16ae4dbae31ab322b91cfa549bdc3c7e1988f8b9;p=jra1mw.git Sort events with identical sequence code according to their timestamps. (Second part of "don't increment seq. # on error" patch from 3.1 merge.) --- diff --git a/org.glite.lb.server/src/jobstat_supp.c b/org.glite.lb.server/src/jobstat_supp.c index 6fb09ef..54351ac 100644 --- a/org.glite.lb.server/src/jobstat_supp.c +++ b/org.glite.lb.server/src/jobstat_supp.c @@ -762,8 +762,16 @@ static int compare_events_by_seq(const void *a, const void *b) { const edg_wll_Event *e = (edg_wll_Event *)a; const edg_wll_Event *f = (edg_wll_Event *)b; + int ret; - return edg_wll_compare_seq(e->any.seqcode, f->any.seqcode); + ret = edg_wll_compare_seq(e->any.seqcode, f->any.seqcode); + if (ret) return ret; + + if (e->any.timestamp.tv_sec < f->any.timestamp.tv_sec) return -1; + if (e->any.timestamp.tv_sec > f->any.timestamp.tv_sec) return 1; + if (e->any.timestamp.tv_usec < f->any.timestamp.tv_usec) return -1; + if (e->any.timestamp.tv_usec > f->any.timestamp.tv_usec) return 1; + return 0; } void edg_wll_SortEvents(edg_wll_Event *e)