Currently timestamp is defined as a u64 type, which doesn't really specify what kind of date and time representation it is. It might be seconds since Unix Epoch or it might noe be. I would suggest to come up with a more explictly date and time resource which provides methods to convert timestamp to different representations. Minimally, it should contain two methods
@Mossaka, this would, more or less, duplicate what wasi-clocks/wall-clock already does; so, reusing what's already provided might be a better approach than building anew.
Currently timestamp is defined as a
u64
type, which doesn't really specify what kind of date and time representation it is. It might be seconds since Unix Epoch or it might noe be. I would suggest to come up with a more explictly date and time resource which provides methods to convert timestamp to different representations. Minimally, it should contain two methodsunix_timestamp() -> i64
to get the Unix timestampunix_timestamp_nanos() -> i128
to get the Unix timestamp in nanosecondsIn addition, we might want to consider adding
from
functions to convert unix timestamp this sturct as constructors.We may want to define other functions such as
date
andtime
to return date and time representations resp.CC @devigned