MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / formatTimeRemaining

Function formatTimeRemaining

subinfo/subinfo.ts:102–109  ·  view source on GitHub ↗
(seconds: number)

Source from the content-addressed store, hash-verified

100 const minutes = Math.floor((seconds % 3600) / 60);
101 const secs = Math.floor(seconds % 60);
102 return `${days.toString().padStart(2, '0')}天${hours.toString().padStart(2, '0')}小时${minutes.toString().padStart(2, '0')}分${secs.toString().padStart(2, '0')}秒`;
103}
104
105// 计算日均使用量
106function calculateDailyUsage(totalUsed: number, startTime: number, currentTime: number): string {
107 const days = Math.max(1, (currentTime - startTime) / 86400);
108 return formatSize(totalUsed / days);
109}
110
111// 计算剩余流量的建议日均用量
112function calculateRemainingDailyAllowance(remain: number, days: number): string {

Callers 2

handleSubinfoMethod · 0.85
handleChaMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected