diff options
| author | 2024-07-26 11:41:19 +0300 | |
|---|---|---|
| committer | 2024-07-26 11:41:19 +0300 | |
| commit | d7680498e1c55025577eb23204e3a2cbd81952d3 (patch) | |
| tree | 633f37012529fd85d939ab94e85e85ab9ae33c04 /src/main.zig | |
| parent | Initial commit (diff) | |
| download | ukkobot-d7680498e1c55025577eb23204e3a2cbd81952d3.tar.gz ukkobot-d7680498e1c55025577eb23204e3a2cbd81952d3.tar.xz ukkobot-d7680498e1c55025577eb23204e3a2cbd81952d3.zip | |
Don't care about receive time
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main.zig b/src/main.zig index 0c524a7..3c75f25 100644 --- a/src/main.zig +++ b/src/main.zig | |||
| @@ -309,11 +309,9 @@ fn onTextCommand(bot: *Bot, msg: types.Message, text: []const u8, cmd: []const u | |||
| 309 | } else if (std.mem.eql(u8, simple_cmd, "ping")) { | 309 | } else if (std.mem.eql(u8, simple_cmd, "ping")) { |
| 310 | var timer = try std.time.Timer.start(); | 310 | var timer = try std.time.Timer.start(); |
| 311 | 311 | ||
| 312 | const recv = msg.date - @as(u64, @intCast(std.time.timestamp())); | ||
| 313 | |||
| 314 | var sb = ArrayList(u8).init(bot.allocator); | 312 | var sb = ArrayList(u8).init(bot.allocator); |
| 315 | defer sb.deinit(); | 313 | defer sb.deinit(); |
| 316 | try sb.writer().print("Pong!\nReceive time: {}s\nSend time: ...", .{recv}); | 314 | try sb.writer().print("Pong!\nSend time: ...", .{}); |
| 317 | 315 | ||
| 318 | const reply = try bot.sendMessage(.{ | 316 | const reply = try bot.sendMessage(.{ |
| 319 | .chat_id = msg.chat.id, | 317 | .chat_id = msg.chat.id, |
| @@ -327,7 +325,7 @@ fn onTextCommand(bot: *Bot, msg: types.Message, text: []const u8, cmd: []const u | |||
| 327 | 325 | ||
| 328 | const send = @as(f64, @floatFromInt(timer.read())) / std.time.ns_per_ms; | 326 | const send = @as(f64, @floatFromInt(timer.read())) / std.time.ns_per_ms; |
| 329 | sb.clearRetainingCapacity(); | 327 | sb.clearRetainingCapacity(); |
| 330 | try sb.writer().print("Pong!\nReceive time: {}s\nSend time: {d}ms", .{ recv, send }); | 328 | try sb.writer().print("Pong!\n\nSend time: {d}ms", .{send}); |
| 331 | 329 | ||
| 332 | try bot.editMessageText_(.{ | 330 | try bot.editMessageText_(.{ |
| 333 | .chat_id = reply.value.chat.id, | 331 | .chat_id = reply.value.chat.id, |