1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013-2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "interface_v3/interface_manager.h"
24 #include "time_client.h"
26 using namespace NLMISC
;
27 using namespace NLGUI
;
31 CInterfaceManager
*pIM
= CInterfaceManager::getInstance();
34 CCDBNodeLeaf
*pNodeLeaf
= CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false);
37 ICDBNode::CTextId textId
;
38 pNodeLeaf
->addObserver(this, textId
);
39 // nlwarning("CPing: cannot add the observer");
42 nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist.");
48 CInterfaceManager
*pIM
= CInterfaceManager::getInstance();
51 CCDBNodeLeaf
*pNodeLeaf
= CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false);
54 ICDBNode::CTextId textId
;
55 pNodeLeaf
->removeObserver(this, textId
);
58 nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist.");
62 void CPing::update(NLMISC::ICDBNode
* node
)
64 CCDBNodeLeaf
*leaf
= safe_cast
<CCDBNodeLeaf
*>(node
);
65 uint32 before
= (uint32
)leaf
->getValue32();
66 uint32 current
= (uint32
)(0xFFFFFFFF & ryzomGetLocalTime());
69 //nlwarning("DB PING Pb before '%u' after '%u'.", before, current);
73 _Ping
= current
- before
;