[pbs-devel] [PATCH vma-to-pbs 4/9] add support for streaming the VMA file via stdin

Max Carrara m.carrara at proxmox.com
Tue Apr 9 15:06:10 CEST 2024


On Tue Apr 9, 2024 at 2:16 PM CEST, Filip Schauer wrote:
> On 03/04/2024 16:52, Max Carrara wrote:
> >> +    let elapsed_ms = SystemTime::now()
> >> +        .duration_since(start_transfer_time)?
> >> +        .as_millis();
> >> +    println!(
> >> +        "Backup finished within {} minutes, {} seconds and {} ms",
> >> +        elapsed_ms / 1000000,
> >> +        (elapsed_ms / 1000) % 60,
> >> +        elapsed_ms % 1000
> >> +    );
> > The seconds are not calculated correctly here: 1s = 60_000ms
> >
> > To make it less error prone, you could just use seconds by default and
> > milliseconds where necessary, e.g.:
> >
> >      let total_seconds = duration.as_secs();
> >
> >      let minutes = total_seconds / 60;
> >      let seconds = total_seconds % 60;
> >      let milliseconds = duration.as_millis() % 1000;
>
> I don't see what about my seconds calculation is wrong, but I adapted
> the code anyway to make it less confusing.

My bad! I phrased that incorrectly; I meant that 1 minute = 60_000ms.
Sorry for the confusion!

>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel





More information about the pbs-devel mailing list