MongoDate quirks

23 views
Skip to first unread message

Josh K

unread,
Sep 6, 2010, 10:51:03 PM9/6/10
to mongodb-user
I recently ran into an issue with timestamps and the PHP MongoDB
driver (more details: http://joshuakehn.com/blog/index.php/basic/view/47/MongoDB-PHP-Driver-Issue-with-Dates).

Currently I add dates via `new MongoDate(strtotime(date("Y-m-d
H:i:s")))`. I'm not sure if this is "proper" or whatnot, however it is
the recommended format (or so it appears: http://www.php.net/manual/en/class.mongodate.php).

After checking my posts I realize that only one actually had a usec
value. Given how I was generating them, it should *not* have had a
usec value.

Is this a bug in how I'm timestamping or within the MongoDate class?

Regards,

-Josh

Kristina Chodorow

unread,
Sep 7, 2010, 10:21:06 AM9/7/10
to mongod...@googlegroups.com
Which version of the driver are you using?  Recent versions shouldn't let you have a usec field of less that 1000. 

If I run echo (new MongoDate(strtotime(date("Y-m-d H:i:s")))) I get 0.00000000 1283869074, do you get something in the usec field?  Do you have code that incorrectly populates the usec field?



--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Joshua Kehn

unread,
Sep 7, 2010, 10:49:11 AM9/7/10
to mongod...@googlegroups.com
Commit hash eb23f0a36cd30a4423a729b1e3901f0b8662710f from July. 

None of the code touches the usec field. Only handles the sec field, and only when it inserts a post.

Regards,

-Josh
____________________________________
Joshua Kehn | Josh...@gmail.com

Kristina Chodorow

unread,
Sep 7, 2010, 11:05:55 AM9/7/10
to mongod...@googlegroups.com
Do you have code that reproduces the problem you're having?
Reply all
Reply to author
Forward
0 new messages