support timeval attributes
authorAleš Křenek <ljocha@ics.muni.cz>
Mon, 19 May 2008 15:40:23 +0000 (15:40 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Mon, 19 May 2008 15:40:23 +0000 (15:40 +0000)
org.glite.lb.client/src/notify.c
org.glite.lb.client/src/notify_supp.cpp

index 0110bb4..f355040 100644 (file)
@@ -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);
 
index 05f3778..56596cd 100644 (file)
@@ -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<JobStatus::Attr>    *fields = (std::vector<JobStatus::Attr> *) 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;