return roundtrip time in ping() callback

This commit is contained in:
Andrey Sidorov 2012-07-17 01:21:28 +10:00
parent f3681b9aa2
commit 8e1f501701

View file

@ -87,9 +87,10 @@ XClient.prototype.terminate = function()
// GetAtomName used as cheapest non-modifying request with reply
// 3 - id for shortest standard atom, "ARC"
XClient.prototype.ping = function(cb) {
var start = Date.now();
this.GetAtomName(3, function(err, str) {
if (err) return cb(err);
return cb();
return cb(null, Date.now() - start);
});
}