use std::time::{SystemTime, UNIX_EPOCH}; use yew::prelude::*; fn time_example() -> Html { let epoch = match SystemTime::now().duration_since(UNIX_EPOCH) { Ok(duration) => duration.as_secs(), Err(err) => { return html! { format!("failed to calculate duration: {}", err) } } }; html! {
{"Seconds since epoch: "}{epoch}
} } struct App; impl Component for App { type Message = (); type Properties = (); fn create(_: &Context