diff --git a/esp/services/ws_fs/ws_fsService.cpp b/esp/services/ws_fs/ws_fsService.cpp index 4a83c2cc65c..4a4fe36c8cc 100644 --- a/esp/services/ws_fs/ws_fsService.cpp +++ b/esp/services/ws_fs/ws_fsService.cpp @@ -331,19 +331,13 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork dest.setStateMessage(statemsg.str()); CDateTime startAt; - CDateTime stoppAt; + CDateTime stopAt; prog->getTimeStarted(startAt); - prog->getTimeStopped(stoppAt); + prog->getTimeStopped(stopAt); + StringBuffer tmpstr; - startAt.getDateString(tmpstr); - tmpstr.append(" "); - startAt.getTimeString(tmpstr); - dest.setTimeStarted(tmpstr.str()); - tmpstr.clear(); - stoppAt.getDateString(tmpstr); - tmpstr.append(" "); - stoppAt.getTimeString(tmpstr); - dest.setTimeStopped(tmpstr.str()); + dest.setTimeStarted(startAt.getString(tmpstr).str()); + dest.setTimeStopped(stopAt.getString(tmpstr.clear()).str()); StringBuffer prgmsg; prog->formatProgressMessage(prgmsg); diff --git a/plugins/fileservices/fileservices.cpp b/plugins/fileservices/fileservices.cpp index 7ccfd26ffc9..a8dea33ee96 100644 --- a/plugins/fileservices/fileservices.cpp +++ b/plugins/fileservices/fileservices.cpp @@ -611,7 +611,7 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo VStringBuffer reason("Blocked by fileservice activity: %s, workunit: %s", label, wuid); setWorkunitState(ctx, WUStateBlocked, reason.str()); - + bool isStartTimeRecorded = false; while(true) { @@ -630,6 +630,7 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo } IConstDFUWorkunit & dfuwu = result->getResult(); + DFUstate state = (DFUstate)dfuwu.getState(); bool aborting = false; Owned wu = ctx->updateWorkUnit(); // may return NULL if (wu.get()) { // if updatable (e.g. not hthor with no agent context) @@ -645,11 +646,32 @@ static void blockUntilComplete(const char * label, IClientFileSpray &server, ICo stat_type costFileAccess = money2cost_type(dfuwu.getFileAccessCost()); updateWorkunitStat(wu, SSTdfuworkunit, wuScope, StCostFileAccess, "", costFileAccess); wu->setApplicationValue(label, dfuwu.getID(), dfuwu.getSummaryMessage(), true); + if (!isStartTimeRecorded) + { + switch (state) + { + case DFUstate_started: + case DFUstate_aborting: + case DFUstate_monitoring: + case DFUstate_aborted: + case DFUstate_failed: + case DFUstate_finished: + + const char * whenStarted = dfuwu.getTimeStarted(); + if (!isEmptyString(whenStarted)) + { + CDateTime startedAt; + startedAt.setString(whenStarted); + updateWorkunitStat(wu, SSTdfuworkunit, wuScope, StWhenStarted, 0, startedAt.getTimeStamp()); + isStartTimeRecorded = true; + } + break; + } + } wu->commit(); wu.clear(); } - DFUstate state = (DFUstate)dfuwu.getState(); if (stateout) stateout->clear().append(dfuwu.getStateMessage()); switch(state)