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

Function asctime_from_tm

crates/vm/src/stdlib/time.rs:490–505  ·  view source on GitHub ↗
(tm: &libc::tm)

Source from the content-addressed store, hash-verified

488
489 #[cfg(any(unix, windows))]
490 fn asctime_from_tm(tm: &libc::tm) -> String {
491 const WDAY_NAME: [&str; 7] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
492 const MON_NAME: [&str; 12] = [
493 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
494 ];
495 format!(
496 "{} {}{:>3} {:02}:{:02}:{:02} {}",
497 WDAY_NAME[tm.tm_wday as usize],
498 MON_NAME[tm.tm_mon as usize],
499 tm.tm_mday,
500 tm.tm_hour,
501 tm.tm_min,
502 tm.tm_sec,
503 tm.tm_year + 1900
504 )
505 }
506
507 #[cfg(not(any(unix, windows)))]
508 impl OptionalArg<StructTimeData> {

Callers 2

asctimeFunction · 0.85
ctimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected