Skip to content

Commit

Permalink
Remove rfc3339 methods for no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Jul 2, 2024
1 parent b0edeac commit fafdce7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ntp64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ impl NTP64 {

/// Convert to a RFC3339 time representation with nanoseconds precision.
/// e.g.: `"2024-07-01T13:51:12.129693000Z"``
#[cfg(feature = "std")]
pub fn to_string_rfc3339(&self) -> String {
#[cfg(feature = "std")]
return format_rfc3339_nanos(self.to_system_time()).to_string();
#[cfg(not(feature = "std"))]
return self.0.to_string();
format_rfc3339_nanos(self.to_system_time()).to_string()
}

/// Parse a RFC3339 time representation into a NTP64.
#[cfg(feature = "std")]
pub fn parse_rfc3339(s: &str) -> Result<Self, ParseNTP64Error> {
match humantime::parse_rfc3339(s) {
Ok(time) => time
Expand Down
2 changes: 2 additions & 0 deletions src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl Timestamp {

/// Convert to a RFC3339 time representation with nanoseconds precision.
/// e.g.: `"2024-07-01T13:51:12.129693000Z/33"``
#[cfg(feature = "std")]
pub fn to_string_rfc3339(&self) -> String {
#[cfg(feature = "std")]
return format!("{:#}", self);
Expand All @@ -72,6 +73,7 @@ impl Timestamp {
}

/// Parse a RFC3339 time representation into a NTP64.
#[cfg(feature = "std")]
pub fn parse_rfc3339(s: &str) -> Result<Self, ParseTimestampError> {
match s.find('/') {
Some(i) => {
Expand Down

0 comments on commit fafdce7

Please sign in to comment.