From eb02b92ebdcd6ce4520262f4c822a1ba582884c5 Mon Sep 17 00:00:00 2001 From: James Clark Date: Mon, 14 Dec 2020 08:35:03 +0700 Subject: [PATCH] Fix timestamp in lang.transaction Part of #267. --- lang/lib/transaction.bal | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/lib/transaction.bal b/lang/lib/transaction.bal index 43ab0267..d4398c80 100644 --- a/lang/lib/transaction.bal +++ b/lang/lib/transaction.bal @@ -23,11 +23,19 @@ type Info readonly & record {| // a previous one int retryNumber; // probably useful for timeouts and logs - timestamp startTime; + Timestamp startTime; // maybe useful Info? prevAttempt; |}; +# An instant in time. +public type Timestamp readonly & object { + # Returns milliseconds since 1970-01-01T00:00:00Z, not including leap seconds + public toMillisecondsInt() returns int; + # Returns a string representation of the timestamp in ISO 8601 format + public toString() returns string; +}; + # Returns information about the current transaction public transactional isolated function info() returns Info = external;