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

Time.now issue #144

Open
dberzano opened this issue Jun 2, 2011 · 1 comment
Open

Time.now issue #144

dberzano opened this issue Jun 2, 2011 · 1 comment

Comments

@dberzano
Copy link

dberzano commented Jun 2, 2011

This is strange. When I assign Time.now to a variable, I expect to have stored in curtime the time when I assigned the value.

Instead, I always get the very current time, i.e. the time when I access the variable:

curtime = Time.now
=> 2011-06-02 16:08:52 +0000
>> curtime
=> 2011-06-02 16:08:54 +0000
>> curtime
=> 2011-06-02 16:08:57 +0000
>> curtime
=> 2011-06-02 16:09:00 +0000
>> curtime
=> 2011-06-02 16:09:03 +0000

Cheers,

Dario Berzano.

@davidmiani
Copy link
Contributor

Confirmed. Unfortunately this is due to the way TryRuby remembers the users session. Instead of keeping an irb process running per user (we had a lot of problems in making that secure), on every method invocation it starts a new session, repeats all past instructions and outputs the result of the latest command. Therefor each time this is done, curtime will get a new value. A similar effect can be seen by running the commands x = rand, x, x; each time x will have a new value.

Unfortunately I don't know an easy solution to this other than to get irb sessions working securely, which would need a lot of rewriting and a way to solve some security issues.

Thanks for the report though, I didn't think of this situation :S

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

No branches or pull requests

2 participants