From 17eaf989e19819b1ab02290e6df26b70beea7881 Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@cray.com>
Date: Thu, 30 Apr 2020 08:21:10 +0200
Subject: [PATCH] serialize timestamp attribute properly

---
 attributes/maestro-schema.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/attributes/maestro-schema.c b/attributes/maestro-schema.c
index f91f94ca..76caa469 100644
--- a/attributes/maestro-schema.c
+++ b/attributes/maestro-schema.c
@@ -2548,8 +2548,23 @@ mstro_attribute_entry_to_mapentry(const struct mstro_attribute_entry_ *entry,
       INFO("POINTER type not serialized\n");
       s=MSTRO_NOENT;
       break;
+    case MSTRO_STP_TIMESTAMP: {
+      res->val->val_case = MSTRO__POOL__AVAL__VAL_TIMESTAMP;
+      res->val->timestamp = malloc(sizeof(Mstro__Pool__Timestamp));
+      if(res->val->timestamp==NULL) {
+        ERR("Failed to allocate timestamp AVal\n");
+        s=MSTRO_NOMEM;
+      }
+      mstro__pool__timestamp__init(res->val->timestamp);
+      const mstro_timestamp *src = (mstro_timestamp*)entry->val;
+      res->val->timestamp->sec = src->sec;
+      res->val->timestamp->nsec = src->nsec;
+      res->val->timestamp->offset = src->offset;
+      break;
+    }
     default:
-      ERR("Unsupported attribute type, can not serialize: %d\n");
+      ERR("Unsupported attribute type for |%s|, can not serialize: %d\n",
+          res->key, entry->kind);
       s=MSTRO_FAIL;
       break;
   }
-- 
GitLab