Should Corda datetimes be in UTC?


Sean
 

Hello,
  The node database has many tables that have columns to store datetimes. See below. 
  The values saved in those columns are represented in the node's local time in the form of yyyy-mm-dd hh:mm:ss.nnn (Note it has no time zone offset).
  But some of them have the corresponding Kotlin type of Instant which is UTC. For example, ValutStates.recordedTime, etc., is Instant. So we are inconsistent - the code is intented for UTC but the DB has local.
  As another use case, consider the scenario with HA where the Hot and Cold nodes are in different time zones. Looking at the data, we may not be certain which time zone it represents because either of the pair may have saved the data.
  What would be desirable is to standardize all the datetimes as UTC. That way, there is no confusion.
  Please advise.
  Thanks.

\Sean  

---------------------------------------------------------------------------------------------------------------
Table Column
cp_states maturity_instant
DATABASECHANGELOG DATEEXECUTED
DATABASECHANGELOGLOCK LOCKGRANTED
node_attachments insertion_date
node_message_ids insertion_time
node_metering_data timestamp
node_mutual_exclusion mutual_exclusion_timestamp
node_scheduled_states scheduled_at
node_transactions timestamp
vault_states consumed_timestamp
vault_states lock_timestamp
vault_states recorded_timestamp
node_notary_request_log request_timestamp


Rick Parker
 

Thanks Sean.  I’ve filed a ticket for the team to pick up.  https://r3-cev.atlassian.net/browse/CORDA-3697

 

From: <corda-dev@groups.io> on behalf of "Sean via groups.io" <sean.zhang@...>
Reply to: "corda-dev@groups.io" <corda-dev@groups.io>
Date: Sunday, 5 April 2020 at 02:41
To: "corda-dev@groups.io" <corda-dev@groups.io>
Subject: [corda-dev] Should Corda datetimes be in UTC?

 

Hello,
  The node database has many tables that have columns to store datetimes. See below. 
  The values saved in those columns are represented in the node's local time in the form of yyyy-mm-dd hh:mm:ss.nnn (Note it has no time zone offset).
  But some of them have the corresponding Kotlin type of Instant which is UTC. For example, ValutStates.recordedTime, etc., is Instant. So we are inconsistent - the code is intented for UTC but the DB has local.
  As another use case, consider the scenario with HA where the Hot and Cold nodes are in different time zones. Looking at the data, we may not be certain which time zone it represents because either of the pair may have saved the data.
  What would be desirable is to standardize all the datetimes as UTC. That way, there is no confusion.
  Please advise.
  Thanks.

\Sean  

---------------------------------------------------------------------------------------------------------------

Table

Column

cp_states

maturity_instant

DATABASECHANGELOG

DATEEXECUTED

DATABASECHANGELOGLOCK

LOCKGRANTED

node_attachments

insertion_date

node_message_ids

insertion_time

node_metering_data

timestamp

node_mutual_exclusion

mutual_exclusion_timestamp

node_scheduled_states

scheduled_at

node_transactions

timestamp

vault_states

consumed_timestamp

vault_states

lock_timestamp

vault_states

recorded_timestamp

node_notary_request_log

request_timestamp