libpldm: bios: implement en/decode for SetDateTime

Add encode/decode functions.
Add unit-test.

Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com>
Change-Id: Ide5563ea5b6446b7300e0d1a9f2b64275217c820
diff --git a/libpldm/utils.h b/libpldm/utils.h
index 73bbf38..133fb4c 100644
--- a/libpldm/utils.h
+++ b/libpldm/utils.h
@@ -6,9 +6,9 @@
 #endif
 
 #include "pldm_types.h"
+#include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
-
 /** @brief Compute Crc32(same as the one used by IEEE802.3)
  *
  *  @param[in] data - Pointer to the target data
@@ -62,6 +62,19 @@
  */
 uint32_t dec2bcd32(uint32_t dec);
 
+/** @brief Check whether the input time is legal
+ *
+ *  @param[in] seconds. Value range 0~59
+ *  @param[in] minutes. Value range 0~59
+ *  @param[in] hours. Value range 0~23
+ *  @param[in] day. Value range 1~31
+ *  @param[in] month. Value range 1~12
+ *  @param[in] year. Value range 1970~
+ *  @return true if time is legal,false if time is illegal
+ */
+bool is_time_legal(uint8_t seconds, uint8_t minutes, uint8_t hours, uint8_t day,
+		   uint8_t month, uint16_t year);
+
 #ifdef __cplusplus
 }
 #endif