[SERVER-350] Append a date as std::time_t to BSONObj from a stream Created: 09/Oct/09 Updated: 12/Jul/16 Resolved: 15/Oct/09 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client, Usability |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.2 |
| Type: | New Feature | Priority: | Trivial - P5 |
| Reporter: | metagoto | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
A small enhancement just to be able to do: BSONObj o = BSON("date" << std::time(0)); Currently, we have to manipulate BSONObjBuilder::appendDate() in order to append a date from a std::time_t. diff --git a/db/jsobj.h b/db/jsobj.h + /** Append a BSON Object ID (OID type). */ |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 16/Oct/09 ] |
|
release 10/16/2009 |
| Comment by metagoto [ 16/Oct/09 ] |
|
1), 2) Yes, you're right. DATENOW is OK for me. A 'now date' from a stream is very useful. Thanks. |
| Comment by Mathias Stearn [ 16/Oct/09 ] |
|
two problems with that: I forgot to mention that we added a DATENOW constant (non-macro) so you can do: if you really need to specify specific dates in the BSON macro I can add something like this: |
| Comment by metagoto [ 16/Oct/09 ] |
|
Did you consider _USE_32BIT_TIME_T ? |
| Comment by Mathias Stearn [ 15/Oct/09 ] |
|
Had to add a new appendTimeT() method because MSVC doesn't consider time_t to be distinct from __int64. |