Answer
Yes – adding a –tzlog command‑line switch (or a configuration option) that lets the user choose UTC or a custom offset for session‑log timestamps is technically feasible without breaking existing PSCP/PSFTP behaviour.
Confirmed Facts
- PuTTY versions 0.70 through 0.78 (the current stable series) write log timestamps using the C library
localtime() in logging.c. The format is YYYY-MM-DD HH:MM:SS followed by a space and the log line, reflecting the client’s local clock. - There is no existing command‑line flag or configuration setting to override this; the only way to obtain UTC timestamps is to set the client OS clock to UTC or post‑process the logs.
- PSCP and PSFTP already convert remote file timestamps from UTC to the client’s local time for display; they do not rely on the session‑log timestamp format.
Likely Explanation / Implementation Steps
- Add a new command‑line option, e.g.,
-tzlog utc or -tzlog offset=+2, that is parsed early in main() alongside existing flags. - Store the chosen mode (local, UTC, or custom offset) in a global variable accessible to the logging routine.
- In
logging.c, replace the direct call to localtime(&now) with a helper that: - uses
gmtime(&now) when the mode is UTC, - applies the supplied offset (e.g.,
now + offset*3600) before calling localtime for a custom offset, - falls back to the current
localtime behaviour when the mode is local (preserving the default).
- Re‑compile PuTTY; the resulting binary will honour the switch while leaving all other code paths unchanged.
Effect on PSCP/PSFTP File‑Time Displays
PSCP and PSFTP obtain file timestamps from the remote server (usually in UTC) and convert them to the client’s local time for display in the UI. This conversion is independent of the session‑log timestamp mechanism. Forcing UTC in the logs therefore does **not** alter how PSCP/PSFTP show file times; they will continue to present times in the client’s local zone unless the client’s own timezone setting is changed.
Recommendation on Default Behaviour
To avoid breaking existing scripts, monitoring tools, or user expectations that rely on local‑time stamps, the default should remain “local time”. The –tzlog switch provides an opt‑out for administrators who need uniform UTC timestamps for cross‑system auditing.
Missing Diagnostic Detail (Only Needed if It Changes the Recommendation)
Please confirm the exact PuTTY version installed on the client machine. If the version is older than 0.70, the logging code may differ and the patch would need to be adapted accordingly.