Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

os.time and os.date API incorrectly implemented #116

Open
ConnorRigby opened this issue Sep 12, 2019 · 5 comments
Open

os.time and os.date API incorrectly implemented #116

ConnorRigby opened this issue Sep 12, 2019 · 5 comments

Comments

@ConnorRigby
Copy link

Official lua implementation:

Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> os.time()
1568313585
> os.date("%M")
40
> os.date("%M", os.time())
40
> 

Luerl:

luerl:eval('print(os.date(\'%M\'))', State0)
2019-09-12 18:45:01 
@rvirding
Copy link
Owner

Yes, the functions don't do what they are supposed to do. They have have a rather low priority. I will take a look at it but one problem is that I can't find a definition of the format string. It doesn't seem to be in the manual.

@rvirding rvirding reopened this Oct 20, 2019
@rvirding
Copy link
Owner

Sorry pushed the wrong button.

@jsimmonds2
Copy link

one problem is that I can't find a definition of the format string. It doesn't seem to be in the manual.

Hello @rvirding. I offer a quote from the Lua 5.2 Reference Manual :)

If format is not "*t", then date returns the date as a string,
formatted according to the same rules as the ISO C function strftime.

@LeeSSXX
Copy link

LeeSSXX commented Dec 24, 2023

I have the same question,Lua can return a normal timestamp, but in Luerl it only returns the current timestamp,
The patch mentioned in the issue was found to be unusable

Lua

local timestamp = os.time({ day = 15, month = 7, year = 2020, hour = 11, min = 16, sec = 22 })
print("test:" .. timestamp)

-> test:1594782982

luerl

local timestamp = os.time({ day = 15, month = 7, year = 2020, hour = 11, min = 16, sec = 22 })
print("test:" .. timestamp)

-> test:1703405864

@rvirding
Copy link
Owner

rvirding commented Jan 4, 2024

I will have a go and look at this. If someone could return an example of the Lua format string that would help.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants