Feature__33_v2.patch
| nel/include/nel/misc/common.h (working copy) | ||
|---|---|---|
| 322 | 322 |
uint32 humanReadableToBytes (const std::string &str); |
| 323 | 323 |
|
| 324 | 324 |
/// Convert a time into a string that is easily readable by an human, for example 3600 -> "1h" |
| 325 |
std::string secondsToHumanReadable (uint32 time);
|
|
| 325 |
std::string secondsToHumanReadable (time_t time);
|
|
| 326 | 326 |
|
| 327 | 327 |
|
| 328 | 328 |
/// Get a bytes or time in string format and convert it in seconds or bytes |
| 329 |
uint32 fromHumanReadable (const std::string &str);
|
|
| 329 |
time_t fromHumanReadable (const std::string &str);
|
|
| 330 | 330 |
|
| 331 | 331 |
|
| 332 | 332 |
/// This function executes a program in the background and returns instantly (used for example to launch services in AES). |
| nel/include/nel/misc/time_nl.h (working copy) | ||
|---|---|---|
| 62 | 62 |
* daylight saving if applicable. |
| 63 | 63 |
* This values is the same on all computer if computers are synchronized (with NTP for example). |
| 64 | 64 |
*/ |
| 65 |
static uint32 getSecondsSince1970 ();
|
|
| 65 |
static time_t getSecondsSince1970 ();
|
|
| 66 | 66 |
|
| 67 | 67 |
/** Return the number of second since midnight (00:00:00), January 1, 1970, |
| 68 | 68 |
* coordinated universal time, according to the system clock. |
| nel/include/nel/net/admin.h (working copy) | ||
|---|---|---|
| 58 | 58 |
std::string Name; // variable name |
| 59 | 59 |
int Update; // delta time in second when we have to check variable |
| 60 | 60 |
|
| 61 |
uint32 LastUpdate; // in second
|
|
| 61 |
time_t LastUpdate; // in second
|
|
| 62 | 62 |
}; |
| 63 | 63 |
|
| 64 | 64 |
typedef void (*TRemoteClientCallback) (uint32 rid, const std::string &cmd, const std::string &entityNames); |
| nel/include/nel/net/service.h (working copy) | ||
|---|---|---|
| 237 | 237 |
sint getExitStatus () const { return _ExitStatus; }
|
| 238 | 238 |
|
| 239 | 239 |
/// Returns the date of launch of the service. Unit: see CTime::getSecondsSince1970() |
| 240 |
uint32 getLaunchingDate () const;
|
|
| 240 |
time_t getLaunchingDate () const;
|
|
| 241 | 241 |
|
| 242 | 242 |
/// Return true if this service don't use the NS (naming service) |
| 243 | 243 |
bool getDontUseNS() const { return _DontUseNS; };
|
| nel/src/misc/common.cpp (working copy) | ||
|---|---|---|
| 395 | 395 |
} |
| 396 | 396 |
|
| 397 | 397 |
|
| 398 |
string secondsToHumanReadable (uint32 time)
|
|
| 398 |
string secondsToHumanReadable (time_t time)
|
|
| 399 | 399 |
{
|
| 400 | 400 |
static const char *divTable[] = { "s", "mn", "h", "d" };
|
| 401 | 401 |
static uint divCoef[] = { 60, 60, 24 };
|
| 402 | 402 |
uint div = 0; |
| 403 |
uint32 res = time;
|
|
| 404 |
uint32 newres = res;
|
|
| 403 |
time_t res = time;
|
|
| 404 |
time_t newres = res;
|
|
| 405 | 405 |
for(;;) |
| 406 | 406 |
{
|
| 407 | 407 |
if(div > 2) |
| ... | ... | |
| 418 | 418 |
return toString ("%u%s", res, divTable[div]);
|
| 419 | 419 |
} |
| 420 | 420 |
|
| 421 |
uint32 fromHumanReadable (const std::string &str)
|
|
| 421 |
time_t fromHumanReadable (const std::string &str)
|
|
| 422 | 422 |
{
|
| 423 | 423 |
if (str.size() == 0) |
| 424 | 424 |
return 0; |
| 425 | 425 |
|
| 426 |
uint32 val;
|
|
| 426 |
time_t val;
|
|
| 427 | 427 |
fromString(str, val); |
| 428 | 428 |
|
| 429 | 429 |
switch (str[str.size()-1]) |
| ... | ... | |
| 451 | 451 |
if (args.size() != 1) |
| 452 | 452 |
return false; |
| 453 | 453 |
|
| 454 |
uint32 seconds;
|
|
| 454 |
time_t seconds;
|
|
| 455 | 455 |
fromString(args[0], seconds); |
| 456 | 456 |
log.displayNL("%s -> %s", args[0].c_str(), secondsToHumanReadable(seconds).c_str());
|
| 457 | 457 |
|
| nel/src/misc/time_nl.cpp (working copy) | ||
|---|---|---|
| 48 | 48 |
* coordinated universal time, according to the system clock. |
| 49 | 49 |
* This values is the same on all computer if computers are synchronized (with NTP for example). |
| 50 | 50 |
*/ |
| 51 |
uint32 CTime::getSecondsSince1970 ()
|
|
| 51 |
time_t CTime::getSecondsSince1970 ()
|
|
| 52 | 52 |
{
|
| 53 |
return uint32(time(NULL));
|
|
| 53 |
return time_t(time(NULL));
|
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
/** Return the number of second since midnight (00:00:00), January 1, 1970, |
| nel/src/net/admin.cpp (working copy) | ||
|---|---|---|
| 68 | 68 |
uint NbWaiting; |
| 69 | 69 |
uint32 NbReceived; |
| 70 | 70 |
TServiceId SId; |
| 71 |
uint32 Time; // when the request was ask
|
|
| 71 |
time_t Time; // when the request was ask
|
|
| 72 | 72 |
|
| 73 | 73 |
TAdminViewResult Answers; |
| 74 | 74 |
}; |
| ... | ... | |
| 304 | 304 |
|
| 305 | 305 |
static void cleanRequest () |
| 306 | 306 |
{
|
| 307 |
uint32 currentTime = CTime::getSecondsSince1970 ();
|
|
| 307 |
time_t currentTime = CTime::getSecondsSince1970 ();
|
|
| 308 | 308 |
|
| 309 | 309 |
for (uint i = 0 ; i < Requests.size ();) |
| 310 | 310 |
{
|
| ... | ... | |
| 634 | 634 |
|
| 635 | 635 |
void updateAdmin() |
| 636 | 636 |
{
|
| 637 |
uint32 CurrentTime = CTime::getSecondsSince1970();
|
|
| 637 |
time_t CurrentTime = CTime::getSecondsSince1970();
|
|
| 638 | 638 |
|
| 639 | 639 |
|
| 640 | 640 |
// |
| ... | ... | |
| 648 | 648 |
// Check graph updates |
| 649 | 649 |
// |
| 650 | 650 |
|
| 651 |
static uint32 lastGraphUpdateCheck = 0;
|
|
| 651 |
static time_t lastGraphUpdateCheck = 0;
|
|
| 652 | 652 |
|
| 653 | 653 |
if (CurrentTime >= lastGraphUpdateCheck+1) |
| 654 | 654 |
{
|
| ... | ... | |
| 714 | 714 |
// Check alarms |
| 715 | 715 |
// |
| 716 | 716 |
|
| 717 |
static uint32 lastAlarmsCheck = 0;
|
|
| 717 |
static time_t lastAlarmsCheck = 0;
|
|
| 718 | 718 |
|
| 719 | 719 |
if (CurrentTime >= lastAlarmsCheck+AlarmCheckDelay) |
| 720 | 720 |
{
|
| nel/src/net/login_server.cpp (working copy) | ||
|---|---|---|
| 51 | 51 |
string UserExtended; // extended data (for free use) |
| 52 | 52 |
uint32 InstanceId; // the world instance in witch the user is awaited |
| 53 | 53 |
uint32 CharSlot; // the expected character slot, any other will be denied |
| 54 |
uint32 Time; // when the cookie is inserted in pending list
|
|
| 54 |
time_t Time; // when the cookie is inserted in pending list
|
|
| 55 | 55 |
}; |
| 56 | 56 |
|
| 57 | 57 |
static list<CPendingUser> PendingUsers; |
| ... | ... | |
| 96 | 96 |
// delete too old cookie |
| 97 | 97 |
|
| 98 | 98 |
list<CPendingUser>::iterator it = PendingUsers.begin(); |
| 99 |
uint32 Time = CTime::getSecondsSince1970();
|
|
| 99 |
time_t Time = CTime::getSecondsSince1970();
|
|
| 100 | 100 |
while (it != PendingUsers.end ()) |
| 101 | 101 |
{
|
| 102 | 102 |
if ((*it).Time < Time - TimeBeforeEraseCookie) |
| nel/src/net/module_gateway_transport.cpp (working copy) | ||
|---|---|---|
| 56 | 56 |
TSockId SockId; |
| 57 | 57 |
|
| 58 | 58 |
/// Time stamp of last message received/emitted |
| 59 |
mutable uint32 LastCommTime;
|
|
| 59 |
mutable time_t LastCommTime;
|
|
| 60 | 60 |
|
| 61 | 61 |
|
| 62 | 62 |
CL3ServerRoute(IGatewayTransport *transport) |
| ... | ... | |
| 115 | 115 |
if (_CallbackServer.get() != NULL) |
| 116 | 116 |
_CallbackServer->update2(100, 0); |
| 117 | 117 |
|
| 118 |
uint32 now = CTime::getSecondsSince1970();
|
|
| 118 |
time_t now = CTime::getSecondsSince1970();
|
|
| 119 | 119 |
// check each connected client for keep alive |
| 120 | 120 |
TRouteMap::iterator first(_Routes.begin()), last(_Routes.end()); |
| 121 | 121 |
for (; first != last; ++first) |
| ... | ... | |
| 402 | 402 |
/// The Client callback |
| 403 | 403 |
mutable CCallbackClient CallbackClient; |
| 404 | 404 |
/// Time stamp of last message received/emitted |
| 405 |
mutable uint32 LastCommTime;
|
|
| 405 |
mutable time_t LastCommTime;
|
|
| 406 | 406 |
|
| 407 | 407 |
/// The last time we try to reconnect (in case of disconnection) |
| 408 |
uint32 LastConnectionRetry;
|
|
| 408 |
time_t LastConnectionRetry;
|
|
| 409 | 409 |
|
| 410 | 410 |
// conn id |
| 411 | 411 |
uint32 ConnId; |
| ... | ... | |
| 521 | 521 |
// delete any route pending |
| 522 | 522 |
deletePendingRoute(); |
| 523 | 523 |
|
| 524 |
uint32 now = CTime::getSecondsSince1970();
|
|
| 524 |
time_t now = CTime::getSecondsSince1970();
|
|
| 525 | 525 |
// update the client connection |
| 526 | 526 |
TClientRoutes::iterator first(_Routes.begin()), last(_Routes.end()); |
| 527 | 527 |
for (; first != last; ++first) |
| nel/src/net/service.cpp (working copy) | ||
|---|---|---|
| 140 | 140 |
//static CLog commandLog; |
| 141 | 141 |
|
| 142 | 142 |
static string CompilationDate; |
| 143 |
static uint32 LaunchingDate;
|
|
| 143 |
static time_t LaunchingDate;
|
|
| 144 | 144 |
|
| 145 | 145 |
static uint32 NbUserUpdate = 0; |
| 146 | 146 |
|
| ... | ... | |
| 1705 | 1705 |
/* |
| 1706 | 1706 |
* Returns the date of launch of the service. Unit: see CTime::getSecondsSince1970() |
| 1707 | 1707 |
*/ |
| 1708 |
uint32 IService::getLaunchingDate () const
|
|
| 1708 |
time_t IService::getLaunchingDate () const
|
|
| 1709 | 1709 |
{
|
| 1710 | 1710 |
return LaunchingDate; |
| 1711 | 1711 |
} |
| nelns/admin_executor_service/admin_executor_service.cpp (working copy) | ||
|---|---|---|
| 100 | 100 |
uint NbWaiting; |
| 101 | 101 |
uint32 NbReceived; |
| 102 | 102 |
TServiceId SId; |
| 103 |
uint32 Time; // when the request was ask
|
|
| 103 |
time_t Time; // when the request was ask
|
|
| 104 | 104 |
|
| 105 | 105 |
TAdminViewResult Answers; |
| 106 | 106 |
}; |
| ... | ... | |
| 122 | 122 |
uint32 PId; /// process Id used to kill the application |
| 123 | 123 |
bool Relaunch; /// if true, it means that the admin want to close and relaunch the service |
| 124 | 124 |
|
| 125 |
uint32 LastPing; /// time in seconds of the last ping sent. If 0, means that the service already pong
|
|
| 125 |
time_t LastPing; /// time in seconds of the last ping sent. If 0, means that the service already pong
|
|
| 126 | 126 |
|
| 127 | 127 |
vector<uint32> WaitingRequestId; /// contains all request that the server hasn't reply yet |
| 128 | 128 |
|
| ... | ... | |
| 197 | 197 |
|
| 198 | 198 |
vector<string> RegisteredServices; |
| 199 | 199 |
|
| 200 |
vector<pair<uint32, string> > WaitingToLaunchServices; // date and alias name
|
|
| 200 |
vector<pair<time_t, string> > WaitingToLaunchServices; // date and alias name
|
|
| 201 | 201 |
|
| 202 | 202 |
vector<string> AllAdminAlarms; // contains *all* alarms |
| 203 | 203 |
|
| ... | ... | |
| 208 | 208 |
// Global Variables (scalars) |
| 209 | 209 |
// |
| 210 | 210 |
|
| 211 |
uint32 LastPing = 0; // contains the date of the last ping sent to the services
|
|
| 211 |
time_t LastPing = 0; // contains the date of the last ping sent to the services
|
|
| 212 | 212 |
|
| 213 | 213 |
|
| 214 | 214 |
// |
| ... | ... | |
| 502 | 502 |
|
| 503 | 503 |
void checkWaitingServices() |
| 504 | 504 |
{
|
| 505 |
uint32 d = CTime::getSecondsSince1970();
|
|
| 505 |
time_t d = CTime::getSecondsSince1970();
|
|
| 506 | 506 |
|
| 507 | 507 |
for(uint i = 0; i < WaitingToLaunchServices.size(); ) |
| 508 | 508 |
{
|
| ... | ... | |
| 520 | 520 |
|
| 521 | 521 |
static void checkPingPong() |
| 522 | 522 |
{
|
| 523 |
uint32 d = CTime::getSecondsSince1970();
|
|
| 523 |
time_t d = CTime::getSecondsSince1970();
|
|
| 524 | 524 |
|
| 525 | 525 |
bool allPonged = true; |
| 526 | 526 |
bool haveService = false; |
| ... | ... | |
| 692 | 692 |
|
| 693 | 693 |
void cleanRequests() |
| 694 | 694 |
{
|
| 695 |
uint32 currentTime = CTime::getSecondsSince1970();
|
|
| 695 |
time_t currentTime = CTime::getSecondsSince1970();
|
|
| 696 | 696 |
|
| 697 | 697 |
// just a debug check |
| 698 | 698 |
for (uint t = 0 ; t < Requests.size(); t++) |
| nelns/admin_service/admin_service.cpp (working copy) | ||
|---|---|---|
| 103 | 103 |
uint NbWaiting; |
| 104 | 104 |
uint32 NbReceived; |
| 105 | 105 |
TSockId From; |
| 106 |
uint32 Time; // when the request was ask
|
|
| 106 |
time_t Time; // when the request was ask
|
|
| 107 | 107 |
|
| 108 | 108 |
uint32 NbRow; |
| 109 | 109 |
uint32 NbLines; |
| ... | ... | |
| 297 | 297 |
// |
| 298 | 298 |
|
| 299 | 299 |
string Email; |
| 300 |
uint32 FirstEmailTime = 0;
|
|
| 300 |
time_t FirstEmailTime = 0;
|
|
| 301 | 301 |
|
| 302 | 302 |
void sendAdminAlert (const char *format, ...) |
| 303 | 303 |
{
|
| ... | ... | |
| 541 | 541 |
|
| 542 | 542 |
void cleanRequest () |
| 543 | 543 |
{
|
| 544 |
uint32 currentTime = CTime::getSecondsSince1970 ();
|
|
| 544 |
time_t currentTime = CTime::getSecondsSince1970 ();
|
|
| 545 | 545 |
|
| 546 | 546 |
bool timeout; |
| 547 | 547 |
|
| tool/path_content_diff/path_content_diff.cpp (working copy) | ||
|---|---|---|
| 131 | 131 |
*/ |
| 132 | 132 |
// |
| 133 | 133 |
|
| 134 |
uint32 LastDisplay = 0, curFile = 0;
|
|
| 134 |
time_t LastDisplay = 0, curFile = 0;
|
|
| 135 | 135 |
|
| 136 | 136 |
// get the list of new or modified files |
| 137 | 137 |
vector<string> differentFiles; |