Use std::time() instead of plain C time()
This commit is contained in:
parent
ccbb736a18
commit
d26824901d
33 changed files with 65 additions and 65 deletions
|
@ -442,7 +442,7 @@ void readonly_context_impl::log_message(const std::string& msg)
|
|||
{
|
||||
if(game_config::debug) {
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(
|
||||
time(nullptr), "ai", get_side(), msg, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
std::time(nullptr), "ai", get_side(), msg, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void formula_ai::handle_exception(const formula_error& e, const std::string& fai
|
|||
|
||||
void formula_ai::display_message(const std::string& msg) const
|
||||
{
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(time(nullptr), "wfl", get_side(), msg,
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), "wfl", get_side(), msg,
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ bool authenticate(config& campaign, const config::attribute_value& passphrase)
|
|||
|
||||
std::string generate_salt(std::size_t len)
|
||||
{
|
||||
boost::mt19937 mt(time(0));
|
||||
boost::mt19937 mt(std::time(0));
|
||||
std::string salt = std::string(len, '0');
|
||||
boost::uniform_int<> from_str(0, 63); // 64 possible values for base64
|
||||
boost::variate_generator< boost::mt19937, boost::uniform_int<>> get_char(mt, from_str);
|
||||
|
@ -576,7 +576,7 @@ void server::handle_request_campaign_list(const server::request& req)
|
|||
{
|
||||
LOG_CS << "sending campaign list to " << req.addr << " using gzip\n";
|
||||
|
||||
std::time_t epoch = time(nullptr);
|
||||
std::time_t epoch = std::time(nullptr);
|
||||
config campaign_list;
|
||||
|
||||
campaign_list["timestamp"] = epoch;
|
||||
|
@ -825,7 +825,7 @@ void server::handle_upload(const server::request& req)
|
|||
LOG_CS << "Upload denied - hidden add-on.\n";
|
||||
send_error("Add-on upload denied. Please contact the server administration for assistance.", req.sock);
|
||||
} else {
|
||||
const std::time_t upload_ts = time(nullptr);
|
||||
const std::time_t upload_ts = std::time(nullptr);
|
||||
|
||||
LOG_CS << "Upload is owner upload.\n";
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ bool chat_command_handler::is_enabled(const map_command_handler<chat_command_han
|
|||
|
||||
void chat_command_handler::print(const std::string& title, const std::string& message)
|
||||
{
|
||||
chat_handler_.add_chat_message(time(nullptr), title, 0, message);
|
||||
chat_handler_.add_chat_message(std::time(nullptr), title, 0, message);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void chat_handler::change_logging(const std::string& data) {
|
|||
const std::string& msg =
|
||||
VGETTEXT("Unknown debug level: '$level'.", symbols);
|
||||
ERR_NG << msg << std::endl;
|
||||
add_chat_message(time(nullptr), _("error"), 0, msg);
|
||||
add_chat_message(std::time(nullptr), _("error"), 0, msg);
|
||||
return;
|
||||
}
|
||||
if (!lg::set_log_domain_severity(domain, severity)) {
|
||||
|
@ -69,7 +69,7 @@ void chat_handler::change_logging(const std::string& data) {
|
|||
const std::string& msg =
|
||||
VGETTEXT("Unknown debug domain: '$domain'.", symbols);
|
||||
ERR_NG << msg << std::endl;
|
||||
add_chat_message(time(nullptr), _("error"), 0, msg);
|
||||
add_chat_message(std::time(nullptr), _("error"), 0, msg);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -79,7 +79,7 @@ void chat_handler::change_logging(const std::string& data) {
|
|||
const std::string& msg =
|
||||
VGETTEXT("Switched domain: '$domain' to level: '$level'.", symbols);
|
||||
LOG_NG << msg << "\n";
|
||||
add_chat_message(time(nullptr), "log", 0, msg);
|
||||
add_chat_message(std::time(nullptr), "log", 0, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void chat_handler::send_command(const std::string& cmd, const std::string& args
|
|||
data.add_child(cmd)["username"] = args;
|
||||
}
|
||||
else if (cmd == "ping") {
|
||||
data[cmd] = std::to_string(time(nullptr));
|
||||
data[cmd] = std::to_string(std::time(nullptr));
|
||||
}
|
||||
else if (cmd == "report") {
|
||||
data.add_child("query")["type"] = "report " + args;
|
||||
|
@ -149,14 +149,14 @@ void chat_handler::add_whisper_sent(const std::string& receiver, const std::stri
|
|||
{
|
||||
utils::string_map symbols;
|
||||
symbols["receiver"] = receiver;
|
||||
add_chat_message(time(nullptr), VGETTEXT("whisper to $receiver", symbols), 0, message);
|
||||
add_chat_message(std::time(nullptr), VGETTEXT("whisper to $receiver", symbols), 0, message);
|
||||
}
|
||||
|
||||
void chat_handler::add_whisper_received(const std::string& sender, const std::string& message)
|
||||
{
|
||||
utils::string_map symbols;
|
||||
symbols["sender"] = sender;
|
||||
add_chat_message(time(nullptr), VGETTEXT("whisper: $sender", symbols), 0, message);
|
||||
add_chat_message(std::time(nullptr), VGETTEXT("whisper: $sender", symbols), 0, message);
|
||||
}
|
||||
|
||||
void chat_handler::send_chat_room_message(const std::string& room,
|
||||
|
@ -178,7 +178,7 @@ void chat_handler::add_chat_room_message_sent(const std::string &room, const std
|
|||
void chat_handler::add_chat_room_message_received(const std::string &room,
|
||||
const std::string &speaker, const std::string &message)
|
||||
{
|
||||
add_chat_message(time(nullptr), room + ": " + speaker, 0, message, events::chat_handler::MESSAGE_PRIVATE);
|
||||
add_chat_message(std::time(nullptr), room + ": " + speaker, 0, message, events::chat_handler::MESSAGE_PRIVATE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
namespace utils {
|
||||
|
||||
std::string format_time_summary(std::time_t t) {
|
||||
std::time_t curtime = time(nullptr);
|
||||
std::time_t curtime = std::time(nullptr);
|
||||
const struct tm* timeptr = localtime(&curtime);
|
||||
if(timeptr == nullptr) {
|
||||
return "";
|
||||
|
|
|
@ -266,7 +266,7 @@ DEFINE_WFL_FUNCTION(debug_print, 1, 2)
|
|||
|
||||
if(game_config::debug) {
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(
|
||||
time(nullptr), "WFL", 0, str1, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
std::time(nullptr), "WFL", 0, str1, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
||||
return var1;
|
||||
|
@ -280,7 +280,7 @@ DEFINE_WFL_FUNCTION(debug_print, 1, 2)
|
|||
|
||||
if(game_config::debug && game_display::get_singleton()) {
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(
|
||||
time(nullptr), str1, 0, str2, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
std::time(nullptr), str1, 0, str2, events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
||||
return var2;
|
||||
|
@ -313,7 +313,7 @@ DEFINE_WFL_FUNCTION(debug_profile, 1, 2)
|
|||
|
||||
if(game_config::debug && game_display::get_singleton()) {
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(
|
||||
time(nullptr), speaker, 0, str.str(), events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
std::time(nullptr), speaker, 0, str.str(), events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -366,7 +366,7 @@ void wml_event_pump::show_wml_messages(std::stringstream& source, const std::str
|
|||
}
|
||||
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(
|
||||
time(nullptr), caption, 0, msg.str(), events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
std::time(nullptr), caption, 0, msg.str(), events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
|
||||
if(to_cerr) {
|
||||
std::cerr << caption << ": " << msg.str() << '\n';
|
||||
|
|
|
@ -67,7 +67,7 @@ void chat_session::add_message(const std::time_t& timestamp,
|
|||
|
||||
void chat_session::add_message(const std::string& user, const std::string& message)
|
||||
{
|
||||
add_message(time(nullptr), user, message);
|
||||
add_message(std::time(nullptr), user, message);
|
||||
}
|
||||
|
||||
void chat_session::clear()
|
||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char** argv)
|
|||
nplayers = std::stoi(argv[7]);
|
||||
}
|
||||
|
||||
srand(time(nullptr));
|
||||
srand(std::time(nullptr));
|
||||
std::cout << generate_map(x,y,iterations,hill_size,lakes,nvillages,nplayers) << "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ debug_clock::time::time() : hour(0), minute(0), second(0), millisecond(0)
|
|||
|
||||
void debug_clock::time::set_current_time()
|
||||
{
|
||||
std::time_t now = ::time(nullptr);
|
||||
std::time_t now = ::std::time(nullptr);
|
||||
tm* stamp = localtime(&now);
|
||||
|
||||
hour = stamp->tm_hour;
|
||||
|
|
|
@ -219,7 +219,7 @@ void chatbox::append_to_chatbox(const std::string& text, std::size_t id, const b
|
|||
const bool chatbox_at_end = log.vertical_scrollbar_at_end();
|
||||
|
||||
const std::string new_text = formatter()
|
||||
<< log.get_label() << "\n" << "<span color='#bcb088'>" << preferences::get_chat_timestamp(time(0)) << text << "</span>";
|
||||
<< log.get_label() << "\n" << "<span color='#bcb088'>" << preferences::get_chat_timestamp(std::time(0)) << text << "</span>";
|
||||
|
||||
log.set_use_markup(true);
|
||||
log.set_label(new_text);
|
||||
|
@ -243,7 +243,7 @@ void chatbox::append_to_chatbox(const std::string& text, std::size_t id, const b
|
|||
|
||||
void chatbox::send_chat_message(const std::string& message, bool /*allies_only*/)
|
||||
{
|
||||
add_chat_message(time(nullptr), preferences::login(), 0, message);
|
||||
add_chat_message(std::time(nullptr), preferences::login(), 0, message);
|
||||
|
||||
::config c {"message", ::config {"message", message, "sender", preferences::login()}};
|
||||
send_to_server(c);
|
||||
|
|
|
@ -84,7 +84,7 @@ std::string get_base_filename()
|
|||
{
|
||||
std::ostringstream ss;
|
||||
|
||||
std::time_t t = time(nullptr);
|
||||
std::time_t t = std::time(nullptr);
|
||||
ss << std::put_time(std::localtime(&t), "%Y%m%d_%H%M%S");
|
||||
|
||||
static unsigned counter = 0;
|
||||
|
|
|
@ -227,7 +227,7 @@ std::ostream &logger::operator()(const log_domain& domain, bool show_names, bool
|
|||
if(precise_timestamp) {
|
||||
print_precise_timestamp(stream);
|
||||
} else {
|
||||
stream << get_timestamp(time(nullptr));
|
||||
stream << get_timestamp(std::time(nullptr));
|
||||
}
|
||||
}
|
||||
if (show_names) {
|
||||
|
@ -256,7 +256,7 @@ void scope_logger::do_log_exit() noexcept
|
|||
} catch(...) {}
|
||||
--indent;
|
||||
do_indent();
|
||||
if (timestamp) (*output_) << get_timestamp(time(nullptr));
|
||||
if (timestamp) (*output_) << get_timestamp(std::time(nullptr));
|
||||
(*output_) << "} END: " << str_ << " (took " << ticks << "ms)\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ std::string unique_log_filename()
|
|||
|
||||
o << log_file_prefix;
|
||||
|
||||
const std::time_t cur = time(nullptr);
|
||||
const std::time_t cur = std::time(nullptr);
|
||||
o << std::put_time(std::localtime(&cur), "%Y%m%d-%H%M%S-");
|
||||
|
||||
o << GetCurrentProcessId() << log_file_suffix;
|
||||
|
|
|
@ -1159,7 +1159,7 @@ protected:
|
|||
|
||||
void print(const std::string& title, const std::string& message)
|
||||
{
|
||||
menu_handler_.add_chat_message(time(nullptr), title, 0, message);
|
||||
menu_handler_.add_chat_message(std::time(nullptr), title, 0, message);
|
||||
}
|
||||
|
||||
void init_map()
|
||||
|
@ -1273,7 +1273,7 @@ void menu_handler::send_chat_message(const std::string& message, bool allies_onl
|
|||
config cfg;
|
||||
cfg["id"] = preferences::login();
|
||||
cfg["message"] = message;
|
||||
const std::time_t time = ::time(nullptr);
|
||||
const std::time_t time = ::std::time(nullptr);
|
||||
std::stringstream ss;
|
||||
ss << time;
|
||||
cfg["time"] = ss.str();
|
||||
|
@ -1946,10 +1946,10 @@ void console_handler::do_whiteboard_options()
|
|||
void menu_handler::do_ai_formula(const std::string& str, int side_num)
|
||||
{
|
||||
try {
|
||||
add_chat_message(time(nullptr), "wfl", 0, ai::manager::get_singleton().evaluate_command(side_num, str));
|
||||
add_chat_message(std::time(nullptr), "wfl", 0, ai::manager::get_singleton().evaluate_command(side_num, str));
|
||||
} catch(const wfl::formula_error&) {
|
||||
} catch(...) {
|
||||
add_chat_message(time(nullptr), "wfl", 0, "UNKNOWN ERROR IN FORMULA");
|
||||
add_chat_message(std::time(nullptr), "wfl", 0, "UNKNOWN ERROR IN FORMULA");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ bool playmp_controller::is_host() const
|
|||
|
||||
void playmp_controller::do_idle_notification()
|
||||
{
|
||||
gui_->get_chat_manager().add_chat_message(time(nullptr), "", 0,
|
||||
gui_->get_chat_manager().add_chat_message(std::time(nullptr), "", 0,
|
||||
_("This side is in an idle state. To proceed with the game, it must be assigned to another controller. You may use :droid, :control or :give_control for example."),
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
|
|
@ -569,7 +569,7 @@ void playsingle_controller::play_ai_turn()
|
|||
*/
|
||||
void playsingle_controller::do_idle_notification()
|
||||
{
|
||||
gui_->get_chat_manager().add_chat_message(time(nullptr), "Wesnoth", 0,
|
||||
gui_->get_chat_manager().add_chat_message(std::time(nullptr), "Wesnoth", 0,
|
||||
"This side is in an idle state. To proceed with the game, the host must assign it to another controller.",
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
|
|
@ -135,13 +135,13 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
|||
|
||||
if (const config &message = cfg.child("message"))
|
||||
{
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(time(nullptr), message["sender"], message["side"],
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), message["sender"], message["side"],
|
||||
message["message"], events::chat_handler::MESSAGE_PUBLIC,
|
||||
preferences::message_bell());
|
||||
}
|
||||
else if (const config &whisper = cfg.child("whisper") /*&& is_observer()*/)
|
||||
{
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(time(nullptr), "whisper: " + whisper["sender"].str(), 0,
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), "whisper: " + whisper["sender"].str(), 0,
|
||||
whisper["message"], events::chat_handler::MESSAGE_PRIVATE,
|
||||
preferences::message_bell());
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ static std::time_t get_time(const config &speak)
|
|||
else
|
||||
{
|
||||
//fallback in case sender uses wesnoth that doesn't send timestamps
|
||||
time = ::time(nullptr);
|
||||
time = std::time(nullptr);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ void game_lua_kernel::log_error(char const * msg, char const * context)
|
|||
void game_lua_kernel::lua_chat(const std::string& caption, const std::string& msg)
|
||||
{
|
||||
if (game_display_) {
|
||||
game_display_->get_chat_manager().add_chat_message(time(nullptr), caption, 0, msg,
|
||||
game_display_->get_chat_manager().add_chat_message(std::time(nullptr), caption, 0, msg,
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -946,7 +946,7 @@ bool luaW_checkvariable(lua_State *L, variable_access_create& v, int n)
|
|||
void chat_message(const std::string& caption, const std::string& msg)
|
||||
{
|
||||
if (!game_display::get_singleton()) return;
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(time(nullptr), caption, 0, msg,
|
||||
game_display::get_singleton()->get_chat_manager().add_chat_message(std::time(nullptr), caption, 0, msg,
|
||||
events::chat_handler::MESSAGE_PUBLIC, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ static lg::log_domain log_server("server");
|
|||
mask_(0),
|
||||
ip_text_(ip),
|
||||
end_time_(end_time),
|
||||
start_time_(time(0)),
|
||||
start_time_(std::time(0)),
|
||||
reason_(reason),
|
||||
who_banned_(who_banned),
|
||||
group_(group),
|
||||
|
@ -236,7 +236,7 @@ static lg::log_domain log_server("server");
|
|||
{
|
||||
return "permanent";
|
||||
}
|
||||
return lg::get_timespan(end_time_ - time(nullptr));
|
||||
return lg::get_timespan(end_time_ - std::time(nullptr));
|
||||
}
|
||||
|
||||
bool banned::operator>(const banned& b) const
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace wesnothd {
|
|||
void init_ban_help();
|
||||
void check_ban_times(std::time_t time_now);
|
||||
inline void expire_bans() {
|
||||
check_ban_times(time(nullptr));
|
||||
check_ban_times(std::time(nullptr));
|
||||
}
|
||||
public:
|
||||
ban_manager();
|
||||
|
|
|
@ -123,7 +123,7 @@ std::string fuh::extract_salt(const std::string& name) {
|
|||
}
|
||||
|
||||
void fuh::user_logged_in(const std::string& name) {
|
||||
set_lastlogin(name, time(nullptr));
|
||||
set_lastlogin(name, std::time(nullptr));
|
||||
}
|
||||
|
||||
bool fuh::user_exists(const std::string& name) {
|
||||
|
|
|
@ -42,7 +42,7 @@ metrics::metrics() :
|
|||
current_requests_(0),
|
||||
nrequests_(0),
|
||||
nrequests_waited_(0),
|
||||
started_at_(time(nullptr)),
|
||||
started_at_(std::time(nullptr)),
|
||||
terminations_()
|
||||
{}
|
||||
|
||||
|
@ -150,7 +150,7 @@ std::ostream& metrics::requests(std::ostream& out) const
|
|||
|
||||
std::ostream& operator<<(std::ostream& out, metrics& met)
|
||||
{
|
||||
const std::time_t time_up = time(nullptr) - met.started_at_;
|
||||
const std::time_t time_up = std::time(nullptr) - met.started_at_;
|
||||
const int seconds = time_up%60;
|
||||
const int minutes = (time_up/60)%60;
|
||||
const int hours = (time_up/(60*60))%24;
|
||||
|
|
|
@ -76,7 +76,7 @@ void wesnothd::player::mark_registered(bool registered)
|
|||
|
||||
bool wesnothd::player::is_message_flooding()
|
||||
{
|
||||
const std::time_t now = time(nullptr);
|
||||
const std::time_t now = std::time(nullptr);
|
||||
if (flood_start_ == 0) {
|
||||
flood_start_ = now;
|
||||
return false;
|
||||
|
|
|
@ -185,7 +185,7 @@ void suh::clean_up() {
|
|||
return;
|
||||
}
|
||||
|
||||
std::time_t now = time(nullptr);
|
||||
std::time_t now = std::time(nullptr);
|
||||
|
||||
//A minute has 60 seconds, an hour 60 minutes and
|
||||
//a day 24 hours.
|
||||
|
@ -205,7 +205,7 @@ bool suh::login(const std::string& name, const std::string& password, const std:
|
|||
}
|
||||
|
||||
void suh::user_logged_in(const std::string& name) {
|
||||
set_lastlogin(name, time(nullptr));
|
||||
set_lastlogin(name, std::time(nullptr));
|
||||
}
|
||||
|
||||
std::string suh::user_info(const std::string& name) {
|
||||
|
|
|
@ -52,8 +52,8 @@ class suh : public user_handler {
|
|||
password(),
|
||||
realname(),
|
||||
mail(),
|
||||
lastlogin(time(nullptr)),
|
||||
registrationdate(time(nullptr)),
|
||||
lastlogin(std::time(nullptr)),
|
||||
registrationdate(std::time(nullptr)),
|
||||
is_moderator(false) {}
|
||||
std::string password;
|
||||
std::string realname;
|
||||
|
|
|
@ -230,8 +230,8 @@ server::server(int port, bool keep_alive, const std::string& config_file, std::s
|
|||
default_time_period_(0),
|
||||
concurrent_connections_(0),
|
||||
graceful_restart(false),
|
||||
lan_server_(time(nullptr)),
|
||||
last_user_seen_time_(time(nullptr)),
|
||||
lan_server_(std::time(nullptr)),
|
||||
last_user_seen_time_(std::time(nullptr)),
|
||||
restart_command(),
|
||||
max_ip_log_size_(0),
|
||||
uh_name_(),
|
||||
|
@ -248,7 +248,7 @@ server::server(int port, bool keep_alive, const std::string& config_file, std::s
|
|||
join_lobby_response_("[join_lobby]\n[/join_lobby]\n", simple_wml::INIT_COMPRESSED),
|
||||
games_and_users_list_("[gamelist]\n[/gamelist]\n", simple_wml::INIT_STATIC),
|
||||
metrics_(),
|
||||
last_ping_(time(nullptr)),
|
||||
last_ping_(std::time(nullptr)),
|
||||
last_stats_(last_ping_),
|
||||
last_uh_clean_(last_ping_),
|
||||
cmd_handlers_(),
|
||||
|
@ -782,7 +782,7 @@ bool server::authenticate(socket_ptr socket, const std::string& username, const
|
|||
}
|
||||
// This name is registered and an incorrect password provided
|
||||
else if(!(user_handler_->login(username, password, seeds_[reinterpret_cast<unsigned long>(socket.get())]))) {
|
||||
const std::time_t now = time(nullptr);
|
||||
const std::time_t now = std::time(nullptr);
|
||||
|
||||
// Reset the random seed
|
||||
seeds_.erase(reinterpret_cast<unsigned long>(socket.get()));
|
||||
|
@ -1740,7 +1740,7 @@ void server::remove_player(socket_ptr socket)
|
|||
connection_log ip_name = connection_log(iter->info().name(), ip, 0);
|
||||
std::deque<connection_log>::iterator i = std::find(ip_log_.begin(), ip_log_.end(), ip_name);
|
||||
if(i != ip_log_.end()) {
|
||||
i->log_off = time(nullptr);
|
||||
i->log_off = std::time(nullptr);
|
||||
}
|
||||
|
||||
player_connections_.erase(iter);
|
||||
|
@ -1812,7 +1812,7 @@ void server::send_server_message_to_all(const std::string& message, socket_ptr e
|
|||
}
|
||||
}
|
||||
|
||||
std::time_t now = time(nullptr);
|
||||
std::time_t now = std::time(nullptr);
|
||||
if (last_ping_ + network::ping_interval <= now) {
|
||||
if (lan_server_ && players_.empty() && last_user_seen_time_ + lan_server_ < now)
|
||||
{
|
||||
|
@ -2034,14 +2034,14 @@ void server::send_server_message_to_all(const std::string& message, socket_ptr e
|
|||
connection_log ip_name = connection_log(pl_it->second.name(), ip, 0);
|
||||
std::deque<connection_log>::iterator i = std::find(ip_log_.begin(), ip_log_.end(), ip_name);
|
||||
if(i != ip_log_.end()) {
|
||||
i->log_off = time(nullptr);
|
||||
i->log_off = std::time(nullptr);
|
||||
}
|
||||
|
||||
players_.erase(pl_it);
|
||||
ghost_players_.erase(e.socket);
|
||||
if (lan_server_)
|
||||
{
|
||||
last_user_seen_time_ = time(0);
|
||||
last_user_seen_time_ = std::time(0);
|
||||
}
|
||||
e.disconnect();
|
||||
DBG_SERVER << "done closing socket...\n";
|
||||
|
@ -2432,7 +2432,7 @@ void server::ban_handler(const std::string& issuer_name, const std::string& /*qu
|
|||
const std::string target(parameters.begin(), first_space);
|
||||
|
||||
const std::string duration(first_space + 1, second_space);
|
||||
std::time_t parsed_time = time(nullptr);
|
||||
std::time_t parsed_time = std::time(nullptr);
|
||||
if (ban_manager_.parse_time(duration, &parsed_time) == false) {
|
||||
*out << "Failed to parse the ban duration: '" << duration << "'\n"
|
||||
<< ban_manager_.get_ban_help();
|
||||
|
@ -2500,7 +2500,7 @@ void server::kickban_handler(const std::string& issuer_name, const std::string&
|
|||
std::string::iterator second_space = std::find(first_space + 1, parameters.end(), ' ');
|
||||
const std::string target(parameters.begin(), first_space);
|
||||
const std::string duration(first_space + 1, second_space);
|
||||
std::time_t parsed_time = time(nullptr);
|
||||
std::time_t parsed_time = std::time(nullptr);
|
||||
if (ban_manager_.parse_time(duration, &parsed_time) == false) {
|
||||
*out << "Failed to parse the ban duration: '" << duration << "'\n"
|
||||
<< ban_manager_.get_ban_help();
|
||||
|
@ -2589,7 +2589,7 @@ void server::gban_handler(const std::string& issuer_name, const std::string& /*q
|
|||
second_space = std::find(first_space + 1, parameters.end(), ' ');
|
||||
|
||||
const std::string duration(first_space + 1, second_space);
|
||||
std::time_t parsed_time = time(nullptr);
|
||||
std::time_t parsed_time = std::time(nullptr);
|
||||
if (ban_manager_.parse_time(duration, &parsed_time) == false) {
|
||||
*out << "Failed to parse the ban duration: '" << duration << "'\n"
|
||||
<< ban_manager_.get_ban_help();
|
||||
|
@ -2815,7 +2815,7 @@ int main(int argc, char** argv) {
|
|||
std::size_t min_threads = 5;
|
||||
std::size_t max_threads = 0;
|
||||
|
||||
srand(static_cast<unsigned>(time(nullptr)));
|
||||
srand(static_cast<unsigned>(std::time(nullptr)));
|
||||
|
||||
std::string config_file;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void user_handler::init_mailer(const config &) {
|
|||
}
|
||||
|
||||
std::string user_handler::create_unsecure_nonce(int length) {
|
||||
srand(static_cast<unsigned>(time(nullptr)));
|
||||
srand(static_cast<unsigned>(std::time(nullptr)));
|
||||
|
||||
std::stringstream ss;
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ static void check_fpu()
|
|||
*/
|
||||
static int do_gameloop(const std::vector<std::string>& args)
|
||||
{
|
||||
srand(time(nullptr));
|
||||
srand(std::time(nullptr));
|
||||
|
||||
commandline_options cmdline_opts = commandline_options(args);
|
||||
game_config::wesnoth_program_dir = filesystem::directory_name(args[0]);
|
||||
|
@ -1033,7 +1033,7 @@ int main(int argc, char** argv)
|
|||
|
||||
try {
|
||||
std::cerr << "Battle for Wesnoth v" << game_config::revision << '\n';
|
||||
const std::time_t t = time(nullptr);
|
||||
const std::time_t t = std::time(nullptr);
|
||||
std::cerr << "Started on " << ctime(&t) << "\n";
|
||||
|
||||
const std::string& exe_dir = filesystem::get_exe_dir();
|
||||
|
|
|
@ -99,7 +99,7 @@ manager::~manager()
|
|||
#if 0
|
||||
static void print_to_chat(const std::string& title, const std::string& message)
|
||||
{
|
||||
display::get_singleton()->add_chat_message(time(nullptr), title, 0, message,
|
||||
display::get_singleton()->add_chat_message(std::time(nullptr), title, 0, message,
|
||||
events::chat_handler::MESSAGE_PRIVATE, false);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue