Skip to content

Commit bbd88f2

Browse files
authored
RUST-838 Improve bson::DateTime now() performance (#260)
This also completes RUST-841
1 parent 58adf73 commit bbd88f2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl crate::DateTime {
7070

7171
/// Returns a [`DateTime`] which corresponds to the current date and time.
7272
pub fn now() -> DateTime {
73-
Self::from_chrono(Utc::now())
73+
Self::from_system_time(SystemTime::now())
7474
}
7575

7676
#[cfg(not(feature = "chrono-0_4"))]

src/oid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ impl ObjectId {
163163
}
164164

165165
/// Returns the raw byte representation of an ObjectId.
166-
pub fn bytes(&self) -> [u8; 12] {
166+
pub const fn bytes(&self) -> [u8; 12] {
167167
self.id
168168
}
169169

src/ser/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum Error {
1414
/// A key could not be serialized to a BSON string.
1515
InvalidDocumentKey(Bson),
1616

17-
/// A general error that ocurred during serialization.
17+
/// A general error that occurred during serialization.
1818
/// See: https://docs.rs/serde/1.0.110/serde/ser/trait.Error.html#tymethod.custom
1919
#[non_exhaustive]
2020
SerializationError {

0 commit comments

Comments
 (0)