MCPcopy Index your code
hub / github.com/RustPython/RustPython / format_asn1_time

Function format_asn1_time

crates/stdlib/src/ssl/cert.rs:197–203  ·  view source on GitHub ↗

Format ASN.1 time to string Formats certificate validity dates in the format: "Mon DD HH:MM:SS YYYY GMT"

(time: &x509_parser::time::ASN1Time)

Source from the content-addressed store, hash-verified

195/// Formats certificate validity dates in the format:
196/// "Mon DD HH:MM:SS YYYY GMT"
197fn format_asn1_time(time: &x509_parser::time::ASN1Time) -> String {
198 let timestamp = time.timestamp();
199 DateTime::<Utc>::from_timestamp(timestamp, 0)
200 .expect("ASN1Time must be valid timestamp")
201 .format("%b %e %H:%M:%S %Y GMT")
202 .to_string()
203}
204
205/// Format certificate serial number to hexadecimal string with even padding
206///

Callers 2

cert_to_dictFunction · 0.85
cert_der_to_dict_helperFunction · 0.85

Calls 3

timestampMethod · 0.80
to_stringMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected