Added options argument to Resource.timestamps, fixed bug #120

Merged
merged 2 commits into from Sep 17, 2012

2 participants

@fb55

This partly fixes #84, the only thing that needs to be done is to actually update atime.

@pksunkara

Check my comment on the diff. Other than that, lgtm.

@fb55

Good catch, thanks :)

@pksunkara

Squash the 1st and 3rd commit.

@fb55

/done

@pksunkara pksunkara merged commit 8c42321 into flatiron:master Sep 17, 2012

1 check passed

Details default The Travis build passed
@markbirbeck markbirbeck commented on the diff Apr 16, 2014
lib/resourceful/resource.js
@@ -826,8 +831,10 @@ Resource.property = function (name, typeOrSchema, schema) {
return definer;
};
-Resource.timestamps = function () {
- this._timestamps = true;
+Resource.timestamps = function (options) {
+ this._ctime = !options || !('ctime' in options) || options.ctime;
+ this._mtime = !options || !('mtime' in options) || options.mtime;
+ this._atime = !!options && !!options.atime;
//
// Remark: All timestamps should be considered Unix time format,
// see: http://en.wikipedia.org/wiki/Unix_time
@markbirbeck
markbirbeck added a line comment Apr 16, 2014

This references Unix time which is seconds since the Unix epoch, but the code is using:

Date.now()

which is milliseconds since the Unix epoch.

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