change time unit of ticket to milliseconds

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c
index 875abcb..c89a5cd 100644
--- a/library/ssl_ticket.c
+++ b/library/ssl_ticket.c
@@ -495,6 +495,18 @@
     }
 
 #if defined(MBEDTLS_HAVE_TIME)
+#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
+    if (session->tls_version == MBEDTLS_SSL_VERSION_TLS1_3) {
+        /* Check for expiration */
+        mbedtls_ms_time_t ticket_age = mbedtls_ms_time() - session->start;
+        mbedtls_ms_time_t ticket_lifetime = ctx->ticket_lifetime * 1000;
+
+        if (ticket_age < 0 || ticket_age > ticket_lifetime) {
+            ret = MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED;
+            goto cleanup;
+        }
+    } else
+#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
     {
         /* Check for expiration */
         mbedtls_time_t current_time = mbedtls_time(NULL);
@@ -505,7 +517,7 @@
             goto cleanup;
         }
     }
-#endif
+#endif /* MBEDTLS_HAVE_TIME */
 
 cleanup:
 #if defined(MBEDTLS_THREADING_C)