From f39b3ce0310df38b5ca76e0d16f855ec17939f43 Mon Sep 17 00:00:00 2001
From: jwindley <jwindley@unknown>
Date: Thu, 20 Nov 2003 16:43:26 +0000
Subject: [PATCH] Report job.start_time as NO_VAL if not yet set; do not pass
 STARTTIME to Maui if not set.

---
 src/plugins/sched/wiki/wiki_request.cpp | 10 ++++++----
 src/slurmctld/sched_upcalls.c           |  8 +++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/plugins/sched/wiki/wiki_request.cpp b/src/plugins/sched/wiki/wiki_request.cpp
index 063479f77b3..827c4c823e2 100644
--- a/src/plugins/sched/wiki/wiki_request.cpp
+++ b/src/plugins/sched/wiki/wiki_request.cpp
@@ -256,10 +256,12 @@ wiki_request_t::compose_response( wiki_request_t	*request,
 			}
 			break;
 		case 't':
-			str += field_str;
-			str += "=";
-			str += (*(time_t *) val);
-			str += ";";
+			if ( (*(time_t *) val) != (time_t) NO_VAL ) {
+				str += field_str;
+				str += "=";
+				str += (*(time_t *) val);
+				str += ";";
+			}
 			break;
 		case 'i':
 			if ( (*(int16_t *) val) != NO_VAL ) {
diff --git a/src/slurmctld/sched_upcalls.c b/src/slurmctld/sched_upcalls.c
index 31a5031fa56..ba17051fc2d 100644
--- a/src/slurmctld/sched_upcalls.c
+++ b/src/slurmctld/sched_upcalls.c
@@ -90,6 +90,7 @@ struct sched_obj_cache_entry
  * default or missing values.
  */
 static int32_t zero_32 = 0;
+static time_t unspecified_time = (time_t) NO_VAL;
 
 static struct job_details *copy_job_details( struct job_details *from );
 static void free_job_details( struct job_details *doomed );
@@ -593,8 +594,13 @@ sched_get_job_start_time( sched_obj_list_t job_data,
 			  int32_t idx,
 			  char *type )
 {
+	time_t start = ( (struct job_record *)job_data->data )[ idx ].start_time;
 	if ( type ) *type = 't';
-	return (void *) &( (struct job_record *)job_data->data )[ idx ].start_time;
+
+	if ( start != (time_t) 0 )
+		return (void *) &( (struct job_record *)job_data->data )[ idx ].start_time;
+	else
+		return (void *) &unspecified_time;
 }
 
 /* ************************************************************************ */
-- 
GitLab