[CDRIVER-195] bson_oid_generated_time returns garbage on systems where time_t is 64bits Created: 25/Jan/13 Updated: 19/Oct/16 Resolved: 22/May/13 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.6, 0.7, 0.7.1 |
| Fix Version/s: | 0.8.1 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | David Crawford | Assignee: | Gary Murakami |
| Resolution: | Done | Votes: | 0 |
| Labels: | bson | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 12.04.1 LTS |
||
| Backwards Compatibility: | Fully Compatible |
| Description |
|
The bson_oid_generated_time function fills in the first 4 bytes of a time_t and returns it. However, time_t length is system dependent. On my mac, it's 32 bits, but on my Ubuntu EC2 machine, it's 64. So on Ubuntu, I'm getting nonsense. Works correctly if I cast the result to a 32 bit int, and then back to a time_t. |
| Comments |
| Comment by Gary Murakami [ 22/May/13 ] |
|
Fixed with the following pull requests |
| Comment by Lorenzo Conti [ 16/Mar/13 ] |
|
I've posted a pull request from my github account to cope with this bug. Please test it and let me know if this bug can be closed. |
| Comment by Lorenzo Conti [ 07/Feb/13 ] |
|
The move to 64 bits time_t is due to the Y2038 bug you can read about in wikipedia and many other sources. The move to 64 bit seems to be getting some momentum so this may need to get some attention. Just my 2 cents ... |