"use strict"; require("../common/vendor.js"); function timestampFormatter(inputTime, isPop = false) { const finalDateObj = { h: null, // 小时 m: null, // 分钟 s: null // 秒 }; let dec = inputTime / 1e3; if (dec <= 0) { dec = 0; } let h = Math.trunc(dec / 3600); h = h < 10 ? "0" + h : h; let m = Math.trunc(dec % 3600 / 60); m = m < 10 ? "0" + m : m; let s = Math.trunc(dec % 3600 % 60); finalDateObj.h = h; finalDateObj.m = m; finalDateObj.s = s; return isPop ? `${h}小时${m}分${s}秒` : finalDateObj; } exports.timestampFormatter = timestampFormatter;