I need to make a modification to a legacy app written in Turbo Pascal 7 which requires me to find out the current timezone offset. The program runs in a DOS box in a 32-bit XP environment.

Anybody know of a way of doing this?

** EDIT **

I probably should add that the reason for this question is because I want to know the UTC time , i.e. I want a way of calling a GetSystemTime equivalent from DOS.

有帮助吗?

解决方案

Try using an Exec statement in Pascal to run the DOS systeminfo command output with a pipe, then parse the resulting output using Pascal. Example...

c:\>systeminfo | find "Time Zone"
Time Zone:                 (UTC-05:00) Eastern Time (US & Canada)

c:\>

It takes a sec on Windows 7 to get the result but it should run faster on XP.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top