Skip to content

Commit a3a5747

Browse files
committed
Change Time display format to Local Time
1 parent 38eb846 commit a3a5747

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Native external dependencies have been integrated into the extension once again (`serialport` and `usb` packages),
1616
so the extension no longer depends on other extensions to provide related functionality.
1717
* Black Magic Probe now supports SWO via the dedicated USB endpoint.
18+
* Time format changed. We now print local time and a GMT offset. Before, it was always printed in GMT so you would have to manually convert it to local time. It will now look like `2025-04-13T19:11:51.929Z GMT-4`. It is still in ISO format but adjusted to local time. We chose not to use strings like PST, EST because this can be confusing across all the timezones across the world
1819
* ST-LINK GDB server (*not* st-util) now supports SWO functionality, using standard configuration options.
1920
* ST-LINK: you can now set `targetProcessor` in `launch.json` and that will set the `-m` option on the gdb-server
2021
* Bugfix [#1007](https://github.com/Marus/cortex-debug/issues/1007): An issue with how gdb works prevented RTOS detection when `"symbolFiles"` was used. It will now work if you do not use additional options to specify sections or a textaddress.

Diff for: src/common.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,31 @@ export class HrTimer {
690690
public createDateTimestamp(): string {
691691
const hrUs = this.createPaddedMs(6);
692692
const date = new Date();
693-
const ret = `[${date.toISOString()}, +${hrUs}ms]`;
693+
const ret = `[${HrTimer.toLocalIsoString(date)}, +${hrUs}ms]`;
694+
return ret;
695+
}
696+
697+
private static tzStr = '';
698+
private static tzOffsetMins = 0;
699+
private static getGmtOffsetString(): string {
700+
if (HrTimer.tzStr === '') {
701+
const date = new Date();
702+
HrTimer.tzOffsetMins = date.getTimezoneOffset();
703+
const tzoHrs = HrTimer.tzOffsetMins / 60;
704+
date.setMinutes(date.getMinutes() - HrTimer.tzOffsetMins);
705+
HrTimer.tzStr = ' GMT' + ((tzoHrs < 0) ? '+' : '-') + tzoHrs.toFixed(1);
706+
if (HrTimer.tzStr.endsWith('.0')) {
707+
HrTimer.tzStr = HrTimer.tzStr.substring(0, HrTimer.tzStr.length - 2);
708+
}
709+
}
710+
return HrTimer.tzStr;
711+
}
712+
713+
public static toLocalIsoString(date: Date): string {
714+
const tzStr = HrTimer.getGmtOffsetString(); // Get this first
715+
const lDate = new Date(date);
716+
lDate.setMinutes(lDate.getMinutes() - HrTimer.tzOffsetMins);
717+
const ret = lDate.toISOString() + HrTimer.getGmtOffsetString();
694718
return ret;
695719
}
696720

Diff for: src/dbgmsgs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class CortexDebugChannel {
1212
};
1313
// (options as any).loglevel = vscode.LogLevel.Trace;
1414
CortexDebugChannel.vscodeDebugChannel = vscode.window.createOutputChannel('Cortex-Debug');
15-
CortexDebugChannel.vscodeDebugChannel.show(true);
15+
CortexDebugChannel.vscodeDebugChannel.hide();
1616
}
1717
}
1818

0 commit comments

Comments
 (0)