| ... | @@ -226,7 +226,6 @@ pub const DateTime = struct { | ... | @@ -226,7 +226,6 @@ pub const DateTime = struct { |
| 226 | .ddd => try writer.writeAll(@tagName(self.weekday)), | 226 | .ddd => try writer.writeAll(@tagName(self.weekday)), |
| 227 | .DD => try writer.print("{:0>2}", .{self.days + 1}), | 227 | .DD => try writer.print("{:0>2}", .{self.days + 1}), |
| 228 | .YYYY => try writer.print("{:0>4}", .{self.years}), | 228 | .YYYY => try writer.print("{:0>4}", .{self.years}), |
| 229 | .mm => try writer.print("{:0>2}", .{self.minutes}), | | |
| 230 | .ss => try writer.print("{:0>2}", .{self.seconds}), | 229 | .ss => try writer.print("{:0>2}", .{self.seconds}), |
| 231 | .SSS => try writer.print("{:0>3}", .{self.ms}), | 230 | .SSS => try writer.print("{:0>3}", .{self.ms}), |
| 232 | .MM => try writer.print("{:0>2}", .{self.months + 1}), | 231 | .MM => try writer.print("{:0>2}", .{self.months + 1}), |
| ... | @@ -263,6 +262,8 @@ pub const DateTime = struct { | ... | @@ -263,6 +262,8 @@ pub const DateTime = struct { |
| 263 | .hh => try writer.print("{:0>2}", .{wrap(self.hours, 12)}), | 262 | .hh => try writer.print("{:0>2}", .{wrap(self.hours, 12)}), |
| 264 | .k => try writer.print("{}", .{wrap(self.hours, 24)}), | 263 | .k => try writer.print("{}", .{wrap(self.hours, 24)}), |
| 265 | .kk => try writer.print("{:0>2}", .{wrap(self.hours, 24)}), | 264 | .kk => try writer.print("{:0>2}", .{wrap(self.hours, 24)}), |
| | 265 | .m => try writer.print("{}", .{self.minutes}), |
| | 266 | .mm => try writer.print("{:0>2}", .{self.minutes}), |
| 266 | | 267 | |
| 267 | else => @compileError("'" ++ @tagName(tag) ++ "' not currently supported"), | 268 | else => @compileError("'" ++ @tagName(tag) ++ "' not currently supported"), |
| 268 | } | 269 | } |
| ... | @@ -411,3 +412,8 @@ fn printOrdinal(writer: anytype, num: u16) !void { | ... | @@ -411,3 +412,8 @@ fn printOrdinal(writer: anytype, num: u16) !void { |
| 411 | fn printLongName(writer: anytype, index: u16, names: []const string) !void { | 412 | fn printLongName(writer: anytype, index: u16, names: []const string) !void { |
| 412 | try writer.writeAll(names[index]); | 413 | try writer.writeAll(names[index]); |
| 413 | } | 414 | } |
| | 415 | |
| | 416 | fn wrap(val: u16, at: u16) !u16 { |
| | 417 | var tmp = val % at; |
| | 418 | return if (tmp == 0) at else tmp; |
| | 419 | } |