diff --git a/LTEMvcApp/Views/Home/Logs.cshtml b/LTEMvcApp/Views/Home/Logs.cshtml
index 418a73f..8dad978 100644
--- a/LTEMvcApp/Views/Home/Logs.cshtml
+++ b/LTEMvcApp/Views/Home/Logs.cshtml
@@ -309,23 +309,48 @@
return dir === 0 ? "Uplink" : "Downlink";
}
- // 格式化日志条目为 HTML 字符串
- function formatLogItem(log, index) {
+ function formatDuration(ms) {
+ if (typeof ms !== 'number' || ms < 0) {
+ return 'Invalid Time';
+ }
+ let remaining = ms;
+ const hours = Math.floor(remaining / 3600000);
+ remaining %= 3600000;
+ const minutes = Math.floor(remaining / 60000);
+ remaining %= 60000;
+ const seconds = Math.floor(remaining / 1000);
+ remaining %= 1000;
+
+ const strMinutes = String(minutes).padStart(2, '0');
+ const strSeconds = String(seconds).padStart(2, '0');
+ const strMs = String(remaining).padStart(3, '0');
+
+ return `${hours}:${strMinutes}:${strSeconds}.${strMs}`;
+ }
+
+ function getDisplayTimestamp(log) {
let timestamp = 'Invalid Date';
- if (log && log.timestamp) {
- const date = new Date(log.timestamp);
- // 验证创建的日期对象是否有效
- if (date instanceof Date && !isNaN(date)) {
- timestamp = date.toISOString();
- } else {
- console.warn(`Could not parse timestamp: ${log.timestamp} for log:`, log);
- }
+ let title = 'Timestamp from server.';
+ let note = '';
+
+ if (log && typeof log.timestamp === 'number') {
+ timestamp = formatDuration(log.timestamp);
+ title = `Duration from start: ${timestamp} (Raw: ${log.timestamp}ms)`;
} else {
- console.warn('Timestamp is missing for log:', log);
+ timestamp = 'Invalid Time';
+ title = 'Timestamp from server was invalid or missing.';
+ note = `
${title}`;
+ console.warn('Timestamp missing or invalid, using fallback for log:', log);
}
+ return { timestamp, title, note };
+ }
+
+ // 格式化日志条目为 HTML 字符串
+ function formatLogItem(log, index) {
+ const { timestamp, title: timestampTitle } = getDisplayTimestamp(log);
return `