-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent time type usage #1178
Comments
"What they're for" is explained in the comment you linked to: #866 (comment), they're numbers with absolute and relative time semantics implied (for formatting and, presumably, to dangle datetime-arithmetic functions on at the SDK level). They exist in the XDR already, we're just not returning the right type here. We should change the host interface. |
Can the SDK move ahead with providing Timepoint to users? The env change doesn't seem to me a particularly high priority, is it? (We can of course change at some point, I am just trying to figure priority) |
It could but it'd require adding more host function calls. The SDK would get a u64, then need to convert it into a Timepoint, then give someone that Timepoint object. So we could do it in the SDK now, and do later in Env if the additional host fn call is bothering folks. |
What version are you using?
2674d86
What did you do?
Used
get_ledger_timestamp
to get timestamp.rs-soroban-env/soroban-env-common/env.json
Lines 77 to 83 in e2f9c1d
What did you expect to see?
A
Timepoint
.What did you see instead?
A
u64
.Discussion
We seem to have these two types
Timepoint
andDuration
that get exposed all the way up in the SDK, however they don't seem to get used anywhere. Even the places in the host interface where one might think a time would be exposed like theget_ledger_timestamp
function, they just use a plain u64.What are
Timepoint
andDuration
for? Should we remove them if they aren't in use? Or are there places that aren't using them should be using them?History
It looks like timepoint and duration were added in:
Timepoint
,Duration
#866In response to this issue:
String
,Timepoint
,Duration
#724According to this comment it sounds like the intent was to use Timepoint for the ledger timestamp:
Ref: #866 (comment)
@jayz22 @graydon What should we do here?
The text was updated successfully, but these errors were encountered: