From 762af15121c98d0cdd15d18cefbf17f08d290ea2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Mon, 19 May 2008 15:40:23 +0000 Subject: [PATCH] support timeval attributes --- org.glite.lb.client/src/notify.c | 2 +- org.glite.lb.client/src/notify_supp.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/org.glite.lb.client/src/notify.c b/org.glite.lb.client/src/notify.c index 0110bb4..f355040 100644 --- a/org.glite.lb.client/src/notify.c +++ b/org.glite.lb.client/src/notify.c @@ -21,7 +21,7 @@ char *TimeToStr(time_t t) { struct tm *tm = gmtime(&t); - sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d'", + sprintf(tbuf,"'%4d-%02d-%02d %02d:%02d:%02d UTC'", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour,tm->tm_min,tm->tm_sec); diff --git a/org.glite.lb.client/src/notify_supp.cpp b/org.glite.lb.client/src/notify_supp.cpp index 05f3778..56596cd 100644 --- a/org.glite.lb.client/src/notify_supp.cpp +++ b/org.glite.lb.client/src/notify_supp.cpp @@ -48,12 +48,15 @@ void dump_fields(void) switch (i->second) { case JobStatus::INT_T: case JobStatus::STRING_T: + case JobStatus::TIMEVAL_T: std::cerr << JobStatus::getAttrName(i->first) << ", "; default: break; } } } +extern "C" { char * TimeToStr(time_t); } + void print_fields(void **ff,const edg_wll_NotifId n,edg_wll_JobStat const *s) { std::vector *fields = (std::vector *) ff; @@ -73,6 +76,10 @@ void print_fields(void **ff,const edg_wll_NotifId n,edg_wll_JobStat const *s) std::string val = stat.getValString(a->first); std::cout << (val.empty() ? "(null)" : escape(val)) << '\t'; } break; + case JobStatus::TIMEVAL_T: { + struct timeval t = stat.getValTime(a->first); + std::cout << TimeToStr(t.tv_sec) << '\t'; + } break; default: std::cout << "(unsupported)"; break; -- 1.8.2.3