Generated file has incorrect date #281

Closed
edbond opened this Issue Jan 10, 2014 · 10 comments

Comments

Projects
None yet
3 participants
@edbond
Contributor

edbond commented Jan 10, 2014

generated hello world dated Jan 1 1970

lein new mies cljstest
cd cljstest
lein cljsbuild once

and the file is Jan 1 1970 cljstest.js

What am I doing wrong?

I asked on SO too, more info there - https://stackoverflow.com/questions/21044524/incorrect-data-for-lein-cljsbuild-file

@cemerick

This comment has been minimized.

Show comment Hide comment
@cemerick

cemerick Jan 10, 2014

Collaborator

The SO info should be here, not there. :-P

The only mtime change of late was #277 (and the only place where lein-cljsbuild changes the mtime AFAICT), but I don't think that's related.

Is this problem affecting you in non-pathological circumstances, or did you just stumble into an interesting edge case?

Collaborator

cemerick commented Jan 10, 2014

The SO info should be here, not there. :-P

The only mtime change of late was #277 (and the only place where lein-cljsbuild changes the mtime AFAICT), but I don't think that's related.

Is this problem affecting you in non-pathological circumstances, or did you just stumble into an interesting edge case?

@edbond

This comment has been minimized.

Show comment Hide comment
@edbond

edbond Jan 10, 2014

Contributor

The web server caches .js file by mtime I think and updates much harder, I had to use while true touch *.js :-)

Contributor

edbond commented Jan 10, 2014

The web server caches .js file by mtime I think and updates much harder, I had to use while true touch *.js :-)

@edbond

This comment has been minimized.

Show comment Hide comment
@edbond

edbond Jan 10, 2014

Contributor

I did asked a friend to reproduce from installing lein (OpenJDK) and he got Jan 8 1970.

Contributor

edbond commented Jan 10, 2014

I did asked a friend to reproduce from installing lein (OpenJDK) and he got Jan 8 1970.

@cemerick

This comment has been minimized.

Show comment Hide comment
@cemerick

cemerick Jan 10, 2014

Collaborator

What version of cljsbuild are you using?

Collaborator

cemerick commented Jan 10, 2014

What version of cljsbuild are you using?

@edbond

This comment has been minimized.

Show comment Hide comment
@edbond

edbond Jan 10, 2014

Contributor

1.0.1

Probably fs/touch doesn't like clojure Ratio as mtime. I will investigate more :)

(type (/ (System/nanoTime) 1000000))
clojure.lang.Ratio

The stat for file contains:

atime   1389359567
mtime   50361
ctime   1389359567
Contributor

edbond commented Jan 10, 2014

1.0.1

Probably fs/touch doesn't like clojure Ratio as mtime. I will investigate more :)

(type (/ (System/nanoTime) 1000000))
clojure.lang.Ratio

The stat for file contains:

atime   1389359567
mtime   50361
ctime   1389359567
@edbond

This comment has been minimized.

Show comment Hide comment
@edbond

edbond Jan 10, 2014

Contributor

nah, nanoTime returns something not connected with current time at all:

http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()

This method can only be used to measure elapsed time and is not related to any other notion of system or wall- clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative).

user> (System/currentTimeMillis)
1389360033730
user> (System/nanoTime)
50833125370818

currentTimeMillis should be used to touch

Contributor

edbond commented Jan 10, 2014

nah, nanoTime returns something not connected with current time at all:

http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()

This method can only be used to measure elapsed time and is not related to any other notion of system or wall- clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative).

user> (System/currentTimeMillis)
1389360033730
user> (System/nanoTime)
50833125370818

currentTimeMillis should be used to touch

@cemerick

This comment has been minimized.

Show comment Hide comment
@cemerick

cemerick Jan 10, 2014

Collaborator

Yeah, I should have remembered that before applying #277. PR welcome to fix.

Collaborator

cemerick commented Jan 10, 2014

Yeah, I should have remembered that before applying #277. PR welcome to fix.

@edbond

This comment has been minimized.

Show comment Hide comment
@edbond

edbond Jan 10, 2014

Contributor

Here you are: #282
Thanks @cemerick

Contributor

edbond commented Jan 10, 2014

Here you are: #282
Thanks @cemerick

@cemerick cemerick closed this in 3f287d5 Jan 10, 2014

cemerick added a commit that referenced this issue Jan 10, 2014

Merge pull request #282 from edbond/master
use current time to touch output file. Fixes gh-281
@robert-stuttaford

This comment has been minimized.

Show comment Hide comment
@robert-stuttaford

robert-stuttaford Jan 10, 2014

We just spent an hour digging into this, and then found that it's been fixed. Thanks for reporting it @edbond and thanks for fixing it so quickly @cemerick !

We just spent an hour digging into this, and then found that it's been fixed. Thanks for reporting it @edbond and thanks for fixing it so quickly @cemerick !

@cemerick

This comment has been minimized.

Show comment Hide comment
@cemerick

cemerick Jan 10, 2014

Collaborator

Good team effort. :-)

Figure on a release sometime next week. In the meantime, [lein-cljsbuild "1.0.2-SNAPSHOT"].

Collaborator

cemerick commented Jan 10, 2014

Good team effort. :-)

Figure on a release sometime next week. In the meantime, [lein-cljsbuild "1.0.2-SNAPSHOT"].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment