OS/400 has several "base time-related" values that most people are familiar with -- system values QTIME and QUTCOFFSET. There is also a "time zone" time-related value that is important for time stamps in several Operations Navigator/iSeries Navigator functions, such as Management Central monitor windows and for Java applications using time stamps. For this Java time zone value to be useful, the "base time-related values" must be set correctly.
Base time-related values
QTIME system value
You know QTIME represents hours, minutes, seconds of the current time -- in hh:mm:ss format. This value must be explicitly set and then changed if your environment switches between standard time and daylight savings time -- typically two times per year.
QUTCOFFSET system value
Several system functions also use the system value QUTCOFFSET, which represents your location's time value difference (plus or minus hours and minutes) from Greenwich Mean Time (GMT). GMT is defined to be 00:00 relative to other QUTCOFFSET values. Management Central functions such as its scheduling functions, system, job and message monitor support require the QTIME and QUTCOFFSET to be set correctly on the central system and on the endpoint systems for the correct time stamps to displayed and used. This value must be explicitly set and then changed if your environment switches between standard time and daylight savings time.
You can view and change these system values through either of the following interfaces:
Time zone-related value
Starting with V5R1 Management Central, time-dependent scheduling functions and displaying correct time of day for functions such as job and message monitors also require setting a specific Java time zone value correctly. Java applications using time stamps also require this. You can set this value using one of the following interfaces:
The Sun Microsystems Inc. Java specification defines the list of valid time zone values, which can be unique per Java Development Kit (JDK) level. Please refer to redpiece Managing OS/400 with V5R1 Operations Navigator: Overview and More: Volume 1, SG24-6220. An appendix includes additional information on this subject. We also found additional resource information in the V5R2 Information Center using +java +time +zone as a search string. The V5R2 information also applies to V5R1.
LC_TOD specification in a locale object
A locale is an object that can determine how data is processed, printed and displayed. Locale information includes categories of statements that define language, cultural data, and character sets. Included in this are monetary symbol, date format, date separator character, time format, time separator character, decimal format, sort sequence and character coded character set identifier (CCSID).
The LC_TOD (Locale Time of Day) category of the locale parameters contains a "time zone name" property, which contains an acronym representing the supported Java time zone value that corresponds to the time difference from GMT and implicitly indicates whether daylight savings is used for your system's location.
The following is an example of the source file statements used to specify LC_TOD in a locale object that, once created, is then referenced by system value QLOCALE:
LC_TOD tzdiff -300 <-- Number of minutes difference from GMT (-5 hours using Americas CDT tname "<C><S><T> <-- Central Standard Time (Americas) dstname "<C><D><T> <-- Central Daylight (Savings) Time (Americas) dststart 4, 1, 1 ,7200 < daylight savings start: 1st week of April, 1st day of week (Sunday), 2:00 am (7200 seconds) dstend 10, 4, 1, 7200 < daylight savings end: 1st week of October, 1st day of week (Sunday), 2:00 am (7200 seconds) dstshift 3600 END LC_TOD
The V5R2 Information Center has several articles on LOCALE and specifically Time of Day (search with +time +zone +locale). OS/400 supplies several locale members in source file QLOCALESRC within library QSYSLOCALE. You copy the appropriate country's locale member into your own library, update that file and specify that file in the Create Locale object command (CRTLOCALE). You then specify the directory path to the locale object in the system value QLOCALE. Example: /qsys.lib/pfrexp.lib/EN_USCST.locale
Java user.timezone property specified in the SystemDefault.Properties file, in the directory path /qibm/userdata/java400 .
You may use this as an alternative to using LC_TOD within a Locale object. This file may optionally contain many defaults to be used by the JVM running under OS/400. The value we are describing here is only user.timezone.
File SystemDefault.Properties is not supplied with your OS/400. You have to create it. There are several ways to create this file and enter the time zone setting. One way is to follow the steps below:
- On your PC workstation, add a Network drive to the target iSeries server to the shared root directory (folder). Drill down to the Java400 sub directory -- /QIBM/UserData/Java400. Alternatively, use Windows Explorer to get to the Java400 sub directory.
- Open the Java400 sub directory. Click File->New->Text Document. Name the file SystemDefault.txt.
- Rename the file to SystemDefault.Properties. Click OK on the warning message window.
- Once the file is on the system in the Java400 subdirectory, open the file with the Windows-provided Notepad (or equivalent) editor. Add the time zone statement as described below. We use the CST "time.zone acronym" in our example: user.timezone=CST
- Java uses QTIME, QUTCOFFSET and the user.timezone property together. Do not insert a blank on either side of the = character. Save the file, then exit the editor.
Once you have created the "time zone locale object" or "time zone SystemDefault.Properties file," you can use Management Central package support to distribute (and "apply") the appropriate object/file to the systems in your network.
Important: In a network with a Management Central central system and systems that could or would be used as Management Central endpoint systems, the Management Central server must be stopped and restarted on each of these servers for any change to take effect throughout the network. If any message, job or system monitor is active on any of the Management Central central system or endpoint systems, the monitor should be stopped and started after the Management Central servers have been stopped and started.
For Java programs you must restart the JVM to use this new property. This could require restarting a WebSphere Application Server instance.
About the author: Jim Cook has worked at IBM Rochester for over 30 years in the areas of communications, performance and general OS/400 system interfaces. He has spent the last 10 years in the iSeries International Technical Support Center.
- Set your system time using FTP
Have a lot of machines that you need to set the time on? Search400.com member Doug Hart found that FTPing into the U.S. Navy time server, he can get the UTC time.
- Get time on iSeries to match time on Windows system
Unfortunately, synching the time for the systems isn't so easy. But Search400.com expert John Kohan has some suggestions that could help get the job done.
- It's about time
As more people around the world move into the WebSphere environment, it's important to have the correct time stamp on your log files and applications. But unless you've been told specifically how to set this, you're out of luck. Bob Cancilla learned the hard way how to do it, and he shares what he learned in this tip.
- According to this tip, there was no way to do this except to parse a screen from the time site. I have been keeping the time in sync for quite some time now. It is very easy to do with V5R1. Simply turn the NT box into a time server on the local network. Then point the SNTP service on the AS/400 at the NT box, then start SNTP. . to turn the NT box into a time server ...
Edit the registry key
Find the REG_DWORD subkey called LocalNTP. Change the value from 0 to 1. Then start the windows time service net start w32time<. To turn the SNTP server on, use OpsNav...
Network - Servers - TCP - SNTP
Configure the settings then start the server. Bob Schaefer
This was first published in August 2002