码迷,mamicode.com
首页 > Web开发 > 详细

为net-snmp添加读readTimeTicks

时间:2015-11-16 13:48:45      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

function readTimeTicks(time){
	if(time === 0) return ‘‘;
	var d = 0, h = 0, m = 0, s = 0;
	d = parseInt(time / (24 * 3600 * 100));
	time = d > 0 ? time % (24 * 3600 * 100) : time;
	h = parseInt(time / (3600 * 100));
	time = h > 0 ? time % (3600 * 100) : time;
	m = parseInt(time / 6000);
	time = m > 0 ? time % 6000 : time;
	s = parseInt(time / 100);
	time = s > 0 ? time % 100 : time;

	if(h < 10) h = ‘0‘ + h;
	if(m < 10) m = ‘0‘ + m;
	if(s < 10) s = ‘0‘ + s;
	if(d > 0){ d = d + ‘天 ‘; }else{ d = ‘‘; }
	return `${d}${h}:${m}:${s}`;
}

  并在readVarbinds函数的type == ObjectType.TimeTicks的逻辑判断里添加

value = readTimeTicks(value);

为net-snmp添加读readTimeTicks

标签:

原文地址:http://www.cnblogs.com/zh33gl/p/4968580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!