dropdown menu

date - time

Time synchronization:timed, ntpd, setclock
ntp is considered superior to timed.

ntpd is a daemon that runs to keep your time up to date/time. For this you must configure ntp.conf so it will know where to get the date/time.
ntpdate is a command that will use ntp.conf to do an update now as opposed to waiting for ntpd to do it.
Translation: You want ntpd, you need to configure ntp.conf. You CAN use ntpdate to do manual updates.

should put this line to /etc/ntp.conf:
server timeserver.domain.com
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace

Date change:
1. stopsrc -s xntpd
2. ntpdate <ntp server>                      <--ntpdate command will decline if xntpd is running
   4 Oct 14:20:07 ntpdate[491628]: step time server offset -32.293912 sec
<<3. smit date>>
4. vi /etc/rc.tcpip
5. uncomment this line: start /usr/sbin/xntpd "$src_running"
6. startsrc -s xntpd


Configuring NTP:

1. lssrc -ls xntpd                          <--Sys peer should show a valid server or

If the server is "insane":
2. vi /etc/ntp.conf:
      Double check that "broadcast client" is commented out.

      stopsrc -s xntpd
      startsrc -s xntpd
     If it is a DB server, use the -x flag to prevent the clock from changing in a negative direction.
     Enter the following:startsrc -s xntpd -a "-x"

3. lssrc -ls xntpd                           <--check if the server is synched. It can take up 12 minutes

1. ntpdate -d ip.address.of.server           <--verify there is a suitable server for synch
The offset must be less than 1000 seconds for xntpd to synch.
If the offset is greater than 1000 seconds, change the time manually on the client and run the ntpdate -d again.

If you get the message, "no server suitable for synchronization found", verify xntpd is running on the server (see above) and that no firewalls are blocking port 123.

2. vi /etc/ntp.conf                          <--specify your xntp server in /etc/ntp.conf, enter:
(Comment out the "broadcastclient" line and add server ip.address.of.server prefer.)
Leave the driftfile and tracefile at their defaults.

3. startsrc -s xntpd                          <--start the xntpd daemon:
(Use the -x flag if it is appropriate for your environment.)

4. vi /etc/rc.tcpip                            <--uncomment xntpd from /etc/rc.tcpip so it will start on a reboot.
Uncomment the following line:
      start /usr/sbin/xntpd "$src_running"
      If using the -x flag, add "-x" to the end of the line. You must include the quotes around the -x.

5. lssrc -ls xntpd            <--verify that the client is synched.
Sys peer should display the IP address or name of your xntp server. This process may take up to 12 minutes.

FOR NTP problem:
# ntpq -p
No association ID's returned

It can be checked with this as well:
# ntpq -p <severname>

# tail /etc/ntp.conf
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace
server timeserver.domain.com prefer
server timeserver2.domain.com

# ping timeserver.domain.com
0821-062 ping: host name timeserver.domain.com NOT FOUND

# tail /etc/netsvc.conf


# nslookup timeserver.domain.com
Server:  ns.domain.com

Name:    timeserver.domain.com

# vi /etc/netsvc.conf
-> hosts=local,bind4

# refresh -s xntpd

# ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
sys_pmm-1        timeserver2     2 u   24   64    1    13.75    1.279 15875.0
timeserver2 .    hopf.           1 u   23   64    3    16.85   -5.670 7875.17


Time Zone variable:

Time Zone variable (TZ) is defined in /etc/environment (echo $TZ), and time zone can be specified in two formats: POSIX and Olson.

It maintains a database for each time zone under the /usr/share/lib/zoneinfo.

# ls -l /usr/share/lib/zoneinfo/Europe
-rw-r--r--    1 bin      bin            2917 Sep 13 2013  Amsterdam
-rw-r--r--    1 bin      bin            1725 Sep 13 2013  Andorra
-rw-r--r--    1 bin      bin            2245 Sep 13 2013  Athens

This format uses known names of cities or regions. We can specify the time zone name in a simple, easy-to-understand format: TZ=America/New_York

The POSIX time zone format is the traditionally used format for AIX systems. The advantage of POSIX is that you can easily and explicitly specify the time zone and daylight saving time (DST) manually.

DST: Daylight Saving Time (this means that we have to change our clock at spring/autumn)

The TZ variable specified in POSIX format contains all information required to identify the time zone, specify when to switch DST on and off, and specify the offset from Coordinated Universal Time (UTC). AIX internally does everything in UTC time, and any display of time to the users is based on the time zone and DST rules specified by TZ variable.

TZ format in POSIX: TZ = local_timezone,date,date
TZ=NFT-1DFT-2,M3.5.0,M10.5.0        <--DST is used
TZ=CUT                              <--DST is not used

Usually letter "D" means Daylight Saving Time (DST). The US rules have letters "S" for standard and "D" for DST.
For example America/New_York zone format in POSIX looks this way: EST5EDT,M3.2.0,M11.1.0  ("EST" and "EDT" shows these changes in the timezone)

if you see this:

NFT             <--name of Standard Time (Oct. -> March)
-1              <--difference between standard time and UTC (or CUT) (it means between Oct. and March our time is behind 1 hour from UTC)
DFT             <--name of Daylight Saving Time (March -> Oct.)
-2              <--difference between DST and UTC (or CUT) (it means between March and Oct our time is behind 2 hour from UTC)

Start Daylight Saving Time:
M3              <--month 3 (March)
              <--5. occurence on that month
0               <--sunday

Stop Daylight Saving Time:
M10             <--month 10 (October)
5               <--5. occurence on that month
0               <--sunday

The "CUT0" is actually another POSIX $TZ value, not an Olson name,and it refers to constant UT+0h, with no DST, and constant abbreviation "CUT".


In 'smit chtz_user' 2 terms are used for setting timezones:

Standard Time: time usually used from end of October until end of March
Daylight Saving Time: this is the time usually used from end of March until end of October

grep TZ /etc/environment                         checking TZ variable (echo $TZ works as well)
tail -1 /usr/share/lib/zoneinfo/Europe/Athens    to get some info regarding POSIX abbreviation from an Olson value
zdump Turkey                                     shows actual date at given zone (zdump CET works as well)
zdump -v CET | grep 2015                         getting info about DST changing date/time in the given year (idtst=0 means DST is turned off)


TZ change:
smitty chtz_user (smitty chtz_date) or chtz
(here you can see timezone list: ls -l /usr/share/lib/zoneinfo)

for example:
chtz EST5EDT                                      <--it will change timezone to EST5EDT

Environment variables are examined when a command starts running. The environment of a process is not changed by altering the /etc/environment file. Any processes that were started prior to the change to the /etc/environment file must be restarted if the change is to take effect for those processes. If the TZ variable is changed, the cron daemon must be restarted, because this variable is used to determine the current local time.


  1. hello aix4adm!!!! Thank you for this awesome resource!

    I am trying to save a logfile with a date in the name, and not having much luck. In my script I specify:
    However this simply results in a file named rsync__`date`.log

    I dont really care about the format of the date/time in the file name. Do you have any help for me?


    1. Hello cpguru21,

      This worked for me: LOGFILE="rsync__`date`.log"
      (Just change the ' to ") I tested it in ksh.

      Hope this helps,

  2. Thanks a bunch Balazs. So this worked well however now my log file has a bunch of spaces in the name which is not ideal. do you have a suggestion to get the date formatted in a way where it is something like rsync__2012010911:30?


  3. sorry Balazs, man page is wonderful thing. Im all set. Thanks again for your awesome blog!

  4. Replies
    1. I was searching for how to synchronize date and time and found your blog. I will try these steps and let you know.

  5. If the day of week is Friday, my date should be moved to next monday.. How can I get this

  6. I know its very basic question only. Hope u guys help me this one. watz the command to check time and date??

  7. Am a learner here. Could u please tel me how to check the size of the file???

  8. ?? shouldn't that be ?

    1. Hi, I used this IBM page as a source fpr that part: http://www-01.ibm.com/support/docview.wss?uid=isg3T1000653

    2. This is from the redbook : The address is a special address that tells the AIX server to
      synchronize to its own system clock. Of course, a computer with a decent
      clock that does not “wander” much should be chosen as the private primary
      NTP server

  9. Hi, Can you tell if there is a way to have the change in time logged by syslogd ? i tried daemon.info in syslog.conf but it does not work.

    regards, Tom

  10. Hi All,

    We received lot of security issues with NTP. Please confirm in /etc/ntp.conf if below setting should be fine.

    restrict default nomask nopeer nomodify notrap noquery
    server abc1.xyz.net prefer
    server abc2.xyz.net
    driftfile /etc/ntp.drift
    tracefile /etc/ntp.trace

  11. instead of editing a file /etс/rс.tсpip, you can use the following command # chssys -s xntpd -a '-x'