lib/mu: use fmt-based time/date formatting
For a small speedup
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2020-2022 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2020-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify it
|
||||
** under the terms of the GNU General Public License as published by the
|
||||
@ -115,7 +115,7 @@ struct Indexer::Private {
|
||||
Scanner scanner_;
|
||||
const size_t max_message_size_;
|
||||
|
||||
time_t dirstamp_{};
|
||||
::time_t dirstamp_{};
|
||||
std::size_t max_workers_;
|
||||
std::vector<std::thread> workers_;
|
||||
std::thread scanner_worker_;
|
||||
@ -161,9 +161,8 @@ Indexer::Private::handler(const std::string& fullpath, struct stat* statbuf,
|
||||
dirstamp_ = store_.dirstamp(fullpath);
|
||||
if (conf_.lazy_check && dirstamp_ >= statbuf->st_ctime &&
|
||||
htype == Scanner::HandleType::EnterNewCur) {
|
||||
mu_debug("skip {} (seems up-to-date: {} >= {})", fullpath,
|
||||
time_to_string("%FT%T", dirstamp_),
|
||||
time_to_string("%FT%T", statbuf->st_ctime));
|
||||
mu_debug("skip {} (seems up-to-date: {:%FT%T} >= {:%FT%T})",
|
||||
fullpath, mu_time(dirstamp_), mu_time(statbuf->st_ctime));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -461,7 +460,7 @@ Indexer::progress() const
|
||||
return priv_->progress_;
|
||||
}
|
||||
|
||||
time_t
|
||||
::time_t
|
||||
Indexer::completed() const
|
||||
{
|
||||
return priv_->completed_;
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
*
|
||||
* @return the time or 0
|
||||
*/
|
||||
time_t completed() const;
|
||||
::time_t completed() const;
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
|
||||
@ -532,12 +532,11 @@ Server::Private::contacts_handler(const Command& cmd)
|
||||
const auto tstampstr = cmd.string_arg(":tstamp").value_or("");
|
||||
const auto maxnum = cmd.number_arg(":maxnum").value_or(0 /*unlimited*/);
|
||||
|
||||
const auto after{afterstr.empty() ? 0 :
|
||||
parse_date_time(afterstr, true).value_or(0)};
|
||||
const auto after{afterstr.empty() ? 0 : parse_date_time(afterstr, true).value_or(0)};
|
||||
const auto tstamp = g_ascii_strtoll(tstampstr.c_str(), NULL, 10);
|
||||
|
||||
mu_debug("find {} contacts last seen >= {} (tstamp: {})",
|
||||
personal ? "personal" : "any", time_to_string("%c", after), tstamp);
|
||||
mu_debug("find {} contacts last seen >= {:%c} (tstamp: {})",
|
||||
personal ? "personal" : "any", mu_time(after), tstamp);
|
||||
|
||||
auto match_contact = [&](const Contact& ci)->bool {
|
||||
if (tstamp > ci.tstamp)
|
||||
|
||||
Reference in New Issue
Block a user