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]
Updated the zip. Fixed the PROTO for DayOfWeek.
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]
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
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.
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.
hutch,
OK, I'll work on some documentation. I'd like to do some more testing on the library too.
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.
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.
Gratsie.
I uploaded a new file in the first post. DaysInMonth is working correctly.
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.
Demo works fine here and the documentation looks good and is clear to read. :U
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]
I should mention that if the Windows OS is NT based you can use SystemTimeToTzSpecificLocalTime (http://msdn2.microsoft.com/en-us/library/ms724949.aspx) to convert a time in UTC to a particular time zone, it makes things a little easier, but not a lot.
I corrected some errors in the DateTime library and uploaded a new file in the first post. I separated the library and the WorldTimes program. The WorldTimes program has not changed.
I added a few functions to the DateTime library that I found I had a need for. I uploaded a new file in the first post. I dropped the plain text documentation and updated the CHM file.
I decided a couple of the functions I added were really just redundant and I removed them. I updated the DateTime library file in the first post. I'm going to try to leave the library alone. :bg
Hello Greg.
The part in bold is missing in your documentation:
INVOKE MonthName, pdt, pszMonthName
And this procedure "MonthName" seems not to function correctly. Otherwise is very good, thanks !
Faiseur,
Thanks for pointing that out. I fixed the documentation. The MonthName procedure definitely had a problem. Somehow I skipped that procedure when doing my testing. :red It was missing a *4 in an index, old C habits. I uploaded a new file for the DateTime library in the first post. I also uploaded a new example program above. Thanks for the feedback.