News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

World Times

Started by GregL, July 21, 2007, 08:58:02 PM

Previous topic - Next topic

GregL

I hadn't posted any code here for quite a while so I decided to post this. Attached is a program that demonstrates how to determine the current time and date for any time zone in the world. It reads the time zone information from the Registry. I haven't built a GUI for it yet, I don't know if I will. If you find any mistakes, or if you find a time that is not correct, please let me know. Hopefully someone will find it useful.



[attachment deleted by admin]

GregL

Updated the zip. Fixed the PROTO for DayOfWeek.


hutch--

Greg,

I have just tweaked it to build in masm32 and it looks good, works fine and would be useful to many people. If its OK with you I would like to include it in the next masm32 version.

I have attached the tweaked version for your approval.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

Hutch,

Of course it's OK. It could be spiffed up some more, but it's good enough to demonstrate how to use the Time Zone information from the Windows Registry, which was my intent. I do have several more procedures that are built on the DATETIME typedef that I could put into a DateTime library for MASM32.

Thanks,

Greg

GregL

I updated the zip file in the first post. It is a version of WorldTimes that will build with MASM32 and it includes a DateTime Library for MASM32.


hutch--

Greg,

Thanks for the effort, the demo builds fine and the library builds fine and looks great. I took the "c:" out of the paths in the demo so it would build on any partition that had masm32 installed on it.

Is there any chance of a minimum decription of what the functions do and how to use them ? Just a simple text file would make it a lot more usable in a hurry.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

hutch,

OK, I'll work on some documentation. I'd like to do some more testing on the library too.


GregL

Hutch,

I uploaded a new file in the first post. It contains the WorldTimes program, the DateTime library and my attempt at some documentation for the DateTime library, it's just a plain text file. Creating the documentation was a good thing, I was able to double check all the parameters and return values. I made some modifications to some of the procedures in the library for error checking and return values. None of it made any difference to the WorldTimes program. The library could still use some more testing.


GregL

I uploaded a new file in the first post. I ran a bunch of tests on the DateTime library, there was a problem with CurrentTimeZoneName and DaysInMonth is still giving the wrong result. Everything else looks good. I don't have time to fix DaysInMonth right now, I'm going to the movie theater, I'll have a crack at it in the morning.


hutch--

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

I uploaded a new file in the first post. DaysInMonth is working correctly.


GregL

I updated the zip file in the first post, a procedure was missing, DateTimeToString. It converts a DATETIME to a ASCIIZ string using the system's default date and time formats. I modified the WorldTimes program to use that, it was using a forced 12-hour time format.




hutch--

Demo works fine here and the documentation looks good and is clear to read.  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL

#13
Hutch,

Thanks.

I updated the zip file in the first post. More improvements.

Attached is a test piece for the DateTime library.

[attachment deleted by admin]

GregL

#14
I should mention that if the Windows OS is NT based you can use SystemTimeToTzSpecificLocalTime to convert a time in UTC to a particular time zone, it makes things a little easier, but not a lot.