Merge branch 'master' of https://git.loafle.net/overflow/overflow_app
This commit is contained in:
commit
d42053995c
|
@ -2,32 +2,32 @@
|
|||
|
||||
|
||||
|
||||
export function int2ip(ipInt: number) {
|
||||
export function int2ip(ipInt: number): string {
|
||||
return ((ipInt >>> 24) + '.' + (ipInt >> 16 & 255) + '.' + (ipInt >> 8 & 255) + '.' + (ipInt & 255));
|
||||
}
|
||||
|
||||
export function ip2int(ip: string) {
|
||||
export function ip2int(ip: string): number {
|
||||
return ip.split('.').reduce(function (ipInt, octet) { return (ipInt << 8) + parseInt(octet, 10); }, 0) >>> 0;
|
||||
}
|
||||
|
||||
export function sec2date(ms: number) {
|
||||
var dateTime = new Date(ms);
|
||||
export function sec2date(ms: number): string {
|
||||
let dateTime = new Date(ms);
|
||||
return dateTime.toLocaleString();
|
||||
}
|
||||
|
||||
function numHex(s: number) {
|
||||
var a = s.toString(16);
|
||||
if ((a.length % 2) > 0) { a = "0" + a; }
|
||||
function numHex(s: number): string {
|
||||
let a = s.toString(16);
|
||||
if ((a.length % 2) > 0) { a = '0' + a; }
|
||||
return a;
|
||||
}
|
||||
|
||||
export function intToMac(macInt: number): string {
|
||||
|
||||
var hexValue = numHex(macInt);
|
||||
let hexValue = numHex(macInt);
|
||||
|
||||
var macaddress = [];
|
||||
let macaddress = [];
|
||||
|
||||
for (var i = 0; i < hexValue.length; i = i + 2) {
|
||||
for (let i = 0; i < hexValue.length; i = i + 2) {
|
||||
macaddress.push(hexValue.substr(i, 2));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user