Skip to content
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

fix: python time externs should return integers #898

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# Extend generated class with our externs
class default__(smithy_dafny_standard_library.internaldafny.generated.Time.default__):
def CurrentRelativeTimeMilli():
return datetime.datetime.now(tz = pytz.UTC).timestamp() * 1000
return round(datetime.datetime.now(tz = pytz.UTC).timestamp() * 1000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we round or truncate the milliseconds?

It looks like Java truncates but .NET rounds.

It probably doesn't matter either way


def CurrentRelativeTime():
return datetime.datetime.now(tz = pytz.UTC).timestamp()
return round(datetime.datetime.now(tz = pytz.UTC).timestamp())

def GetCurrentTimeStamp():
try:
Expand All @@ -22,4 +22,4 @@ def GetCurrentTimeStamp():


# Export externs
smithy_dafny_standard_library.internaldafny.generated.Time.default__ = default__
smithy_dafny_standard_library.internaldafny.generated.Time.default__ = default__
Loading