Created
June 1, 2015 05:20
-
-
Save ranisalt/0958d5e2589cd73ba71d to your computer and use it in GitHub Desktop.
Player login/out timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b05c021f0023fb17ab502e0b7dc0baecedcb0c7f Mon Sep 17 00:00:00 2001 | |
From: Ranieri Althoff <[email protected]> | |
Date: Mon, 1 Jun 2015 02:16:42 -0300 | |
Subject: [PATCH] Add timestamp to player log in/out message | |
--- | |
src/player.cpp | 10 ++++++++-- | |
1 file changed, 8 insertions(+), 2 deletions(-) | |
diff --git a/src/player.cpp b/src/player.cpp | |
index 82425d7..251fa6c 100644 | |
--- a/src/player.cpp | |
+++ b/src/player.cpp | |
@@ -1160,7 +1160,10 @@ void Player::onCreatureAppear(Creature* creature, bool isLogin) | |
bed->wakeUp(this); | |
} | |
- std::cout << name << " has logged in." << std::endl; | |
+ using clk = std::chrono::system_clock; | |
+ auto now = clk::to_time_t(clk::now()); | |
+ std::cout << "[" << std::put_time(std::localtime(&now), "%T") | |
+ << "] " << name << " has logged in." << std::endl; | |
if (guild) { | |
guild->addMember(this); | |
@@ -1375,7 +1378,10 @@ void Player::onRemoveCreature(Creature* creature, bool isLogout) | |
g_chat->removeUserFromAllChannels(*this); | |
- std::cout << getName() << " has logged out." << std::endl; | |
+ using clk = std::chrono::system_clock; | |
+ auto now = clk::to_time_t(clk::now()); | |
+ std::cout << "[" << std::put_time(std::localtime(&now), "%T") | |
+ << "] " << name << " has logged out." << std::endl; | |
if (guild) { | |
guild->removeMember(this); | |
-- | |
2.4.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment