mirror of
https://github.com/tiennm99/ccstatusline.git
synced 2026-10-13 20:14:28 +00:00
Detect block boundaries after 60 minutes of inactivity instead of requiring a 5-hour gap. This prevents block start times from carrying over into short midday breaks and ensures elapsed time matches ccusage. Co-authored-by: alexander.buyanov <alexander.buyanov@konux.de>
This commit is contained in:
1 parent
d9ee110fc7
commit
798b637c58
1 file changed
+2
-1
+2
-1
@@ -183,6 +183,7 @@ function findMostRecentBlockStartTime(
|
|||||||
sessionDurationHours = 5
|
sessionDurationHours = 5
|
||||||
): BlockMetrics | null {
|
): BlockMetrics | null {
|
||||||
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
const sessionDurationMs = sessionDurationHours * 60 * 60 * 1000;
|
||||||
|
const sessionGapThresholdMs = Math.min(sessionDurationMs, 60 * 60 * 1000); // treat >=1h inactivity as boundary
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
// Step 1: Find all JSONL files with their modification times
|
// Step 1: Find all JSONL files with their modification times
|
||||||
@@ -256,7 +257,7 @@ function findMostRecentBlockStartTime(
|
|||||||
|
|
||||||
const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
|
const gap = previousTimestamp.getTime() - currentTimestamp.getTime();
|
||||||
|
|
||||||
if (gap >= sessionDurationMs) {
|
if (gap >= sessionGapThresholdMs) {
|
||||||
// Found a true session boundary
|
// Found a true session boundary
|
||||||
foundSessionGap = true;
|
foundSessionGap = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user