Added reset of ts.minutes inside addMinutesToTimestamp function

main
Anastasia Kisner 2024-10-27 00:44:48 +02:00
parent 358b3bf4fc
commit 8b75a185a2
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
const std = @import("std");
const writer = std.io.getStdOut().writer(); //rausnehmen
const writer = std.io.getStdOut().writer();
const Timestamp = struct {
@ -55,10 +55,11 @@ pub fn addMinutesToTimestamp(ts: *Timestamp, min: u16) !void{
if ((addMinutes + ts.minutes) >= 60){
addMinutes = (addMinutes + ts.minutes)%60;
addHours += 1;
ts.minutes = 0;
}
ts.hours += addHours;
ts.hours += addMinutes;
ts.minutes += addMinutes;
}