harness: full-date timestamps on forwarded matrix messages (Pierre De Lancre)
This commit is contained in:
1 parent
9f7b573d01
commit
ac4571e751
1 file changed
+8
-2
@@ -561,13 +561,19 @@ pub fn main(init: std.process.Init) !void {
|
||||
if (!std.mem.eql(u8, ev.sender, peer)) continue;
|
||||
if (ev.body.len == 0) continue;
|
||||
|
||||
var ts_buf: [16]u8 = undefined;
|
||||
var ts_buf: [24]u8 = undefined;
|
||||
const ts_str: []const u8 = blk: {
|
||||
if (ev.ts <= 0) break :blk "";
|
||||
const secs: u64 = @intCast(@divTrunc(ev.ts, 1000));
|
||||
const epoch = std.time.epoch.EpochSeconds{ .secs = secs };
|
||||
const day = epoch.getEpochDay();
|
||||
const year_day = day.calculateYearDay();
|
||||
const month_day = year_day.calculateMonthDay();
|
||||
const sod = epoch.getDaySeconds();
|
||||
break :blk std.fmt.bufPrint(&ts_buf, " {d:0>2}:{d:0>2}Z", .{ sod.getHoursIntoDay(), sod.getMinutesIntoHour() }) catch "";
|
||||
break :blk std.fmt.bufPrint(&ts_buf, " {d:0>4}-{d:0>2}-{d:0>2} {d:0>2}:{d:0>2}Z", .{
|
||||
year_day.year, month_day.month.numeric(), month_day.day_index + 1,
|
||||
sod.getHoursIntoDay(), sod.getMinutesIntoHour(),
|
||||
}) catch "";
|
||||
};
|
||||
|
||||
// Attachment: download locally and forward the path to the agent.
|
||||
|
||||
Reference in new issue
Block a user