Use the same ObjectId generation algorithm in native code

Without the call to htonl() object ids generated within the same second have an unusually high probability of being in the "wrong order", which caused problems for the Bugsnag test-suite when upgrading to mongoid 4.