21
Sat, Dec
3 New Articles

TechTip: Pardon Me, but Do You Have the Time?

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

In today's world, where business processes depend on multiple servers and platforms constantly passing transactions back and forth, even slight time differences between servers can make audit trails impossible to decipher. This is where Simple Network Time Protocol (SNTP) comes in. Simply put, SNTP is a means by which client computers can synchronize their system time with a server system. In this article, we'll explore the enhancements to time synchronization capabilities that IBM added into V5R3.

Client or Server

As I mentioned, the concept behind SNTP is pretty basic. An SNTP client computer is able to automatically adjust its system clock to match that of an SNTP server. The big news in V5R3 is that IBM has added SNTP server capabilities to the existing SNTP client support. This means that in the scenario I just described, the iSeries can play both roles. Now, the iSeries can not only be a client to a time server, but also act as a time server to supply time synchronization services to clients. It can also do both at the same time, synchronizing its time from a public time server and then making synchronization services available to client computers on the local network. IBM has also changed the SNTP client by adding support for multiple time servers, by allowing you to define how the time is adjusted, and by changing which clock is updated. Prior to V5R3, the SNTP client would update the software clock. Now, the system clock is updated.

Let's start off by examining how to set up your iSeries as a time server.

Server Configuration

The process to set up your iSeries as an SNTP server is pretty basic. This can be accomplished using the Change SNTP Attribute (CHGNTPA) command. It's important to note that this command is used to configure both server and client SNTP attributes. Three of the command's parameters are used to configure the SNTP server attributes:

CHGNTPA Parameters for Configuring SNTP Server Attributes
Parameter
Description
SVRAUTOSTR
Defines whether or not to automatically start the SNTP server job when TCP/IP services are started with the STRTCP command
SVRACTLOG
Defines what level of activity logging should be written to the activity logging file located in the IFS folder /QIBM/USERDATA/OS400/TCPIP/NTP/SERVER
SYNCRQD
Identifies whether the SNTP client should be used to synchronize the time with an external time server before starting the time server


The auto start parameter (SVRAUTOSTR) accepts a value of either *YES to define that the SNTP server should start automatically when the TCP/IP server is started or *NO to prevent the SNTP server from starting.

The server activity logging parameter (SVRACTLOG) accepts a value of *NONE to identify that no logging will be done. The value *ERROR is used to define that log entries will be written whenever an error occurs during synchronization. All requests made to the SNTP server will result in a log entry if the value *ALL is specified.

The synchronization required (SYNCRQD) accepts a value of *YES or *NO.

The command below would be used to configure the iSeries SNTP server to run at startup with error logging but without synchronization prior to starting.

CHGNTPA SVRAUTOSTR(*YES) SVRACTLOG(*ERROR) SYNCRQD(*NO)      

After executing this command, you can either stop and start TCP/IP using the ENDTCP and STRTCP commands or simply use the STRTCPSVR command as shown below.

STRTCPSVR SERVER(*NTP) NTPSRV(*SERVER)

Note that the NTPSRV parameter here signifies that the SNTP server service should be started. Once the SNTP server is started, client computers can be configured to utilize the iSeries as a time server.

Client Configuration

The client configuration is also accomplished using the CHGNTPA command. The following seven parameters define SNTP client attributes:

CHGNTPA Parameters for Configuring SNTP Client Attributes
Parameter
Description
RMTSYS
Defines a list of host names or IP addresses of NTP servers to be used for synchronization
AUTOSTART
Identifies whether the SNTP client should be started automatically when TCP/IP is started
POLLITV
Defines the interval in minutes between time server connections
MINADJ
Sets the minimum adjustment difference in milliseconds
MAXADJ
Sets the maximum adjustment difference in minutes
ADJTHLD
Sets the adjustment threshold used to determine whether to reset the clock or gradually adjust it
ACTLOG
Defines the level of client activity log entries to be written to a log file in the IFS folder /QIBM/USERDATA/OS400/TCPIP/NTP


The remote system parameter (RMTSYS) has been enhanced in V5R3 to allow not only one, but multiple time servers. When multiple time servers are specified, the first available time server is used. This gives the SNTP client greater support for failover in case one or more of the time servers is down. It's important to note that if the time server specified is external to your local network (outside of your firewall), your firewall configuration may need to be changed to allow UDP traffic on port 123.

The auto start parameter (AUTOSTART) is used here much in the same way it's used on the server parameter. If *YES is specified, the SNTP client automatically starts when TCP/IP is started.

The poll interval (POLLITV) parameter identifies the number of minutes that should elapse between connections to the time server.

The min and max adjustment parameters (MINADJ and MAXADJ, respectively) allow you to define minimum and maximum differences between client and server times for which adjustments will be made. If, when a connection is made, the difference between the server time and the client time is less than the min (in milliseconds) or greater than the max (in minutes), the time on the client will not be adjusted.

The adjustment threshold parameter (ADJTHLD) identifies the method that should be used to adjust the time, based on a specified number of seconds difference in time. This new parameter in V5R3 adds support for controlling how the time on the local system is updated. If the difference between the server time and the client time is less than the specified value, the clock will be adjusted gradually up or down until the two clocks match. This is done to prevent sudden clock changes, which could cause havoc with applications that use the time value. If, however, the difference is greater than the number of seconds specified, the clock will simply be reset to the server time. The optional special value of *MAXADJ can be specified to identify that any differences up to the value of the MAXADJ parameter should be gradually adjusted and not simply reset.

The activity log parameter (ACTLOG) accepts a value of *NONE to define that no activity log entries should be written, a value of *CHANGE to define that log entries will be written only when a time change occurs, or a value of *POLL to define that a log entry should be written every time a connection is made to the time server and the server sends a response.

The CHGNTPA command below gives an example of configuring the SNTP client.

CHGNTPA RMTSYS('lerc-dns.lerc.nasa.gov') AUTOSTART(*YES) 
     POLLITV(1) MINADJ(1000) MAXADJ(10) ADJTHLD(*MAXADJ) 
     ACTLOG(*POLL)                    

This configuration will result in an SNTP client configuration containing a single time server that will be polled every minute and for which adjustments will be made only when the difference is more than 10 seconds and less than 10 minutes. Any differences less than the maximum adjustment value will be gradually made over a short time. Any other time difference is ignored. Log entries will be written for each time that the client polls the server.

After issuing this command, the SNTP client will be started automatically the next time that TCP/IP is started. Alternatively, you can manually start the SNTP client using the STRTCPSVR command shown below:

STRTCPSVR SERVER(*NTP) NTPSRV(*CLIENT)   

As we saw earlier, the NTPSRV parameter allows us to define whether to start the SNTP client or server. This parameter also accepts a special value of *CFGFILE, which tells the command to check the auto start options defined on the CHGSNTPA command for both server and client. Using this option, you can manually start both client and server with a single command.

Time Zones

When you're retrieving the time from a public time server, it's important to realize that the time server you're using could be anywhere in the world. For that reason, your system must be configured to the correct time zone. Time zone definitions can be found using the Work with Time Zones (WRKTIMZON) command. Figure 1 below shows the WRKTIMZON display.

http://www.mcpressonline.com/articles/images/2002/V5R3TimeSynchV4--07220500.png
Figure 1: The WRKTIMZON display is used to set up time zone information. (Click image to enlarge.)

This screen allows us to view and change the definition of available time zones. The offset value determines the number of hours that a given time zone is offset from the world clock (GMT). These values are used in conjunction with the QTIMZON system value to help the SNTP server and client determine what the time is on the local system. You can use option 8 from this screen to update the system value with a given time zone description.

Where Do You Find the Time?

Now that you know how to set up the iSeries to utilize SNTP, you may be wondering where you can get a list of available public time servers. This Web site gives information on servers that are open to the public and those that have closed (private) access. You also might want to check out www.ntp.org for more information on how time synchronization works.

Mike Faust is an application programmer for Fidelity Integrated Financial Solutions in Maitland, Florida. Mike is also the author of the books The iSeries and AS/400 Programmer's Guide to Cool Things and Active Server Pages Primer and SQL Built-in Functions and Stored Procedures. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: