Novell Home

Time in the NetWare Environment

Articles and Tips: article

MARCUS WILLIAMSON
Consultant
Novell Consulting Services (Europe)

01 Jan 1994


This AppNote describes how time is maintained and used in the DOS and NetWare environments. The AppNote includes information regarding synchronization of NetWare time to external time sources.

Time in the NetWare Environment

Maintaining the correct system date and time is important to all operating systems, including DOS, OS/2, Macintosh, Unix, and NetWare. This AppNote deals with the subject of time from the point of view of the Intel-based PC running DOS and file servers running NetWare 2, 3, and 4.

The Intel-based DOS PC requires a correct system time primarily for use by the file system. When a file is changed, the date and time stamps in the directory associated with that file are also changed.

For the NetWare server, maintaining the correct date and time is important not just to the file system, but also for access security, auditing, and - in the case of NetWare 4 - directory synchronization.

PC Hardware Time

Looking closely at the system board of any AT-class PC will reveal a chip labelled Real-Time Clock (RTC), Motorola MC146818, Dallas DS, or something similar. It is this device which is responsible for the PC's "hardware" clock. A Programmable Timer/Counter chip, running at 1.19318 MHz, generates a signal approximately 18.2065 times a second, which is used to update the RTC. In all machines equipped with an RTC, the clock is backed up by CMOS memory and a battery.

The specification for early PCs did not include a real-time clock. They required the user to enter the date and time when the PC was powered on. Later models included a card which would keep the workstation clock running even when the PC had been switched off. A battery on the card would back up the clock and allow the clock to continue running for as long as the battery lasted. These cards were the forerunners of today's RTC devices.

An RTC chip can be addressed by placing a command in I/O port 70h, then reading back the result from I/O port 71h. The simple BASIC program in Appendix A shows how it is possible to read the current time from the RTC. The PC BIOS and DOS define interrupt calls to access the time and date information held by the RTC. Most high level languages also provide functions to get and set the clock from within a program.

DOS Time

Anyone who has set up a PC for the first time will be familiar with the Date and Time prompts which are generated by default for a machine without an AUTOEXEC.BAT file. At the DOS prompt, the equivalent commands DATE and TIME allow setting of the PC's software clock. In PCs equipped with an RTC, this also has the effect of setting the hardware clock.

See Appendix B for the DOS INT 21h calls which DATE and TIME use to get and set the DOS software clock.

DOS File System

DOS maintains only one date and time stamp for each file or directory on a local floppy or hard disk. The date and time stamp is initialized when a file is first created and changed whenever a file is updated. A TOUCH utility, such as the one available with Novell DOS 7, allows a user to modify the file date and time stamp as required.

The DOS date and time stamp described here is the equivalent of the NetWare 'Last Modified Date'. See the NetWare File System section for more details. See Appendix B for the DOS INT 21h calls which are used to get and set the date and time stamp on a file.

NetWare DOS Workstation

When connecting to the network, the DOS user generally executes the following steps, usually as part of AUTOEXEC.BAT or another DOS batch file:

LSL.COM
NE2000.COM
IPXODI.COM

followed by

NETX.EXE

or

VLM.EXE

By default, NETX.EXE or VLM.EXE will retrieve the current time from the server to which the workstation attaches. This time will then be used to set the hardware and software clock for the PC.

There are some situations where this may not be desirable. For example, a PC which does not have a local server may connect to a server in another continent via an asynchronous or ISDN link. When the connection is made and NETX is loaded, it is important that the PC's local time remain local and not be set to that of the server.

Placing the command

SET STATION TIME=OFF

in the NET.CFG file will disable setting of workstation time to the server time when NETX.EXE or VLM.EXE is loaded.

In the case of a workstation loading the VLM workstation components, this command would appear in the NETWARE DOS REQUESTER section of the NET.CFG file, as follows:

NETWARE DOS REQUESTER
  SET STATION TIME=OFF

Once this change has been made, the workstation time will remain set to the local PC time, unless a SYSTIME command (see below) is issued later.

DOS Workstation Time at Login

LOGIN.EXE will also attempt to ensure that the workstation time is the same as the server time. By default, the server time is retrieved and written to the DOS system clock and workstation RTC.

Placing the command

SET_TIME OFF

in the Login Script for the remote user will ensure that the workstation time remains local even after the login process has completed.

Login Process

During the login process, a property of the User object in the bindery of the NetWare 2 or 3 server is updated. The update also occurs to an attribute of the User object if the user is logging into a NetWare 4 server.

The attribute or property which is updated contains the date and time of login, according to the file server, for the user.

In the login script, the attribute may be viewed by placing the line LASTLOGIN in the Login Script. For example:

WRITE "Logged in on %MONTH/%DAY/%YEAR";
WRITE " at %HOUR:%MINUTE:%SECOND" 
LASTLOGIN

would display the date and time of the current login, followed on the next line by the date and time of the last login. This might be useful as a simple security check for users, who can then determine whether anyone has logged in using their account since they last did so.

To obtain the value of this bindery property in the NetWare 2 or 3 environment via a program, it is possible to read the value of the LOGIN_CONTROL property for the user. The property is formatted as shown in Appendix C.

NetWare File Server Time

NetWare needs to maintain correct system time in order to keep file date and time stamps correctly, for auditing and logging, and to allow or deny access to the server based on a user's Login Time Restrictions. In the NetWare 4 environment, time must be accurate on all servers in order to ensure that the Directory Services databases are synchronized between servers. (See "Time Synchronization in NetWare 4.x" in the November 1993 NetWare Application Notes for a full discussion of this subject.)

When the NetWare server starts up, it reads the value of the RTC, which should have already been set by the PC's SETUP program. Once the server is up, it keeps its own software clock for the benefit of the NetWare operating system and its users.

Getting File Server Time

At the NetWare console, the command TIME allows the system administrator to view the current time.

A user may check the server time at any stage by issuing the SYSTIME command, optionally suffixed by a servername. An additional effect of using SYSTIME is that it will set the workstation clock to the clock of any server on the network.

For example

SYSTIME UK-LAB10

might display

Current System Time:  Tuesday  November 16, 1993  7:38 pm

It would then use this time from the UK-LAB10 server to set the workstation software and RTC clock. Note that the update between server and workstation is occurring only once.

SYSTIME uses the NWGetFileServerDateAndTime API as described in Appendix C and DOS INT21h calls as described in Appendix B.

Setting File Server Time

To set the time use the SET TIME command at the server console or the FCONSOLE workstation utility.

FCONSOLE will allow a Console Operator or Supervisor (and equivalents) to display and/or change the current date and time on a given server (see Figure 1).

Figure 1: FCONSOLE display of current server time.

FCONSOLE uses the NWGetFileServerDateAndTime and NWSetFileServerDateAndTime APIs as described in Appendix C.

NetWare File System

The following screen from the FILER utility illustrates the four date and time stamps maintained by NetWare for every file. Although FILER displays only the dates, all except Last Accessed Date are actually stored as a date and time stamp value.

The meanings and functions of each value are:

Creation Date. The date that the file was created. This date should not change during the lifetime of a file.

Last Accessed Date. The date that the file was last read. This may in many cases be the same as the Last Modified Date.

Last Archived Date. The date that the file was last backed up. Last Archived Date is only updated by backup systems which are NetWare-aware. Correct use of the Last Archived Date allows incremental backups to be performed.

Last Modified Date. The date that the file was last amended. This date may be the same as the Last Accessed Date.

Figure 2: FILER display of file date and time stamps.

Internal Time Synchronization

NetWare servers read the RTC during the server startup then maintain their own software clock. In situations where there are frequent switches to real mode (for example, to read the floppy drive), the software clock may appear to run too slowly.

The following patch for NetWare 3.11 servers is designed to resynchronize the software clock with the RTC. The patch is part of 311PTD.EXE in the Compuserve NOVFILES forum.

SYNCTIME NLM    2211   12-19-92   2:37p

This patch forces the server's date/time to be synchronized to the hardware's clock at specified intervals. This NLM eliminate the gradual loss of time experienced by the server due to "missed" clock ticks while the server is in real mode.

The default update frequency is 60 seconds. This may be changed by using

LOAD SYNCTIME DELAY=hex_seconds

where hex_seconds is a hexadecimal value representing the frequency of internal synchronization.

The patch is not required for NetWare 3.12 or 4.x.

External Time Synchronization

The November 1993 AppNote "Time Synchronization in NetWare 4.x" dealt with the subject of synchronizing time within the NetWare 4 environment and mentioned one available external device.

There are many instances where it may be necessary to synchronize a single PC or a NetWare 2, 3, or 4 server to an external time source for other reasons. These might include employee time logging, airline check-in applications, or source code control systems, as possible examples

Time sources are available via the Internet, modem, or radio links. Of these, modem and radio sources are most commonly used to synchronize the clocks on PC workstations and NetWare servers.

Summary

This AppNote has covered the subject of time in the NetWare environment, including synchronization of DOS and NetWare systems to external time sources. It is intended that the Time Synchronization Solutions Guide be regularly updated and uploaded to the NetWire NOVLIB forum library.

If you have information relating to synchronization solutions not listed, please send them to Marcus Williamson as:

MJWILLIA @ NOVELL (MHS) 71333,1665 (Compuserve) MJWILLIA @ NOVELL.COM (Internet)

Appendix A: Example Programs

Example BASIC program to read the RTC:

10 REM RTCLOCK.BAS - For QBASIC or QB
20 '
30 CLS
40 DO
50 OUT &H70, 0
60 RTSECONDS = INP(&H71)
70 OUT &H70, 2
80 RTMINUTES = INP(&H71)
90 OUT &H70, 4
100 RTHOURS = INP(&H71)
110 LOCATE 1, 1
120 PRINT STRING$(20, " ")
130 LOCATE 1, 1
100 PRINT "Real Time Clock now - ";
110 PRINT HEX$(RTHOURS); ":";
120 PRINT HEX$(RTMINUTES); ":";
130 PRINT HEX$(RTSECONDS)
140 LOOP UNTIL INKEY$ <> ""
150 END

Example BASIC program demonstrating access to the NIST time source:

10 REM NISTTEST.BAS - For QBASIC or QB
15 CLS
20 COM(2) ON
30 ON COM(2) GOSUB 200
40 T$ = ""
50 OPEN "COM2:1200,N,8,1,BIN,RB1024" FOR RANDOM AS 1
60 PRINT #1, "ATZ" + CHR$(13)
70 T$ = ""
80 T = TIMER
90 DO
100 LOOP UNTIL TIMER > T + 5
105 REM Change the line below to include international access code if required
110 PRINT #1, "AT DT 3034944774" + CHR$(13)
120 T = TIMER
130 DO
140 LOOP UNTIL TIMER > T + 60
150 PRINT
160 PRINT T$
170 CLOSE 1
180 END
190 '
200 L$ = INPUT$(1, #1)
210 PRINT L$;
220 RETURN

Appendix B: BIOS/DOS Function Calls Involving Time

BIOS Read/Set Real-Time Clock  INT 1A, Function 02 (Read) or 03 (Set)
    Registers set or returned are:

    CH = hours (BCD format)
    CL = minutes (BCD format) 
    DH = seconds (BCD format)
    DL = daylight savings time flag


DOS Get Time        DOS INT 21, Function 2Ch
    This will retrieve the current time on a DOS PC, and is used as follows:
    
	AH = 2C
    
	Registers returned are:
    
	CH = hours, CL = minutes, DH = seconds, DL = hundredths


DOS Set Time        DOS INT 21, Function 2Dh
   This will set current time on a DOS PC as follows:

   AH = 2D

   Registers to be set are:

   CH = hours, CL = minutes, DH = seconds, DL = hundredths

   Note that most PCs cannot and do not maintain time in resolution
   of hundredths of a second. The maximum possible resolution is 0.05493 seconds 
   (1/18.20648).


DOS Get Date        INT 21h, Function 2Ah
   AH = 2A

   Registers returned are:

   CX = Year (1980 to 2099)
   DH = Month (1 to 12) 
   DL = Day (1 to 31) 
   AL = Day of Week (0=Sunday)


DOS Set Date        INT 21h, Function 2Bh
   AH = 2B

   Registers to be set are:

   CX = Year (1980 to 2099) 
   DH = Month (1 to 12)  
   DL = Day  (1 to 31)  
   AL = Day of Week (0=Sunday))

Appendix C: NetWare Time at the Low Level

Format of the LOGIN_CONTROL Bindery Property
Offset    Field                            Size Type    Comment  
0         Account Expiration Date          3    bytes   Yr Mn Dy 
3         Account Disabled Flag            1    byte    00h or FFh 
4         Password Expiration Date         3    bytes   Yr Mn Dy  
7         Grace Logins Remaining           1    byte    FFh=unlimited
8         Password Expiration Interval     2    word    Days 
10        Grace Login Reset Value          1    byte    
11        Minimum Password Length          1    byte
12        Maximum Concurrent Connections   2    word
14        Allowed Login Time Bitmap        42   bytes   1 bit=1/2 hr 
56        Last Login Date and Time         6    bytes   YMD HMS  
62        Restriction Flags                1    byte
63        Unused                           1    byte
64        Maximum Disk Usage in Blocks     4    long    Block=4k 
68        Bad Login Count                  2    word    
70        Next Reset Time                  4    long    
74        Bad Login Address                14   bytes   net:node:socket  
Client SDK API calls for getting and setting time  
NWGetFileServerDateAndTime is defined in the Client SDK as:

NWCCODE NWAPI NWGetFileServerDateAndTime(
  NWCONN_HANDLE conn,
  BYTE NWPTR dateTimeBuffer);

NWSetFileServerDateAndTime is defined in the Client SDK as:

NWCCODE NWAPI NWSetFileServerDateAndTime(  
  NWCONN_HANDLE conn,
  BYTE NWPTR dateTimeBuffer);

Both of these calls use a buffer which has the structure:

Byte  Value          Range
0     Year           80-179
1     Month          1-12
2     Day            1-31
3     Hour           0-23
4     Minute         0-59
5     Second         0-59
6     Day of Week    0-6, 0=Sunday

Appendix D: Time Synchronization Solutions Guide

The following list provides details of some manufacturers and suppliers of hardware and software for maintaining DOS and NetWare Time. Please note that inclusion in this list does not constitute certification or recommendation of any of these products.

Software  : Time Master
Hardware  : Contact MDI for details
Sources   : WWVB, DCF77, NIST, NRC

Supplier  : MDI, 311 B Avenue, Suite A
            Lake Oswego
            Oregon 97034
			USA

Telephone : +1 503 635 6370
Fax       : +1 503 636 9501

Provides a Time Master (TM.NLM) and Time Slave (TS.NLM) which
may be used to synchronize time on 2.x, 3.x and 4.x servers as
well as device drivers for DOS and OS/2 workstations.

Software  : RTCTOOLS.NLM
Hardware  : CTS-10 Card
Source    : WWVB

Supplier  : Odetics, Inc via
            Personal Computer Tools
            90 Industrial Park RD
			Hingham, MA 02043
            USA

Telephone : +1 800 767 6728
Fax       : +1 617 740 2728

Provides hardware card, antenna and RTCTOOLS.NLM software for
receiving WWVB broadcast.


Software  : Cadence
Hardware  : COM1:/COM2: Serial Port
Source    : NIST 

Supplier  : C-Note Software, Inc
            St Louis, MO

Telephone : +1 314 997 9689
Fax       : +1 314 997 9666
Internet  : C-NOTE@POLYGON.COM

Provides NLM which can synchronize to NIST and NBS time sources
via dial-up modem.

Software  : WANTimes
Hardware  : COM1:/COM2: Serial Port
Source    : NIST

Supplier  : Legal File Software
CSERVE    : 71224,161

NetWare client software which dials NIST then sets the clocks
of all File Servers to the time received. This software can be
downloaded from the Compuserve NOVUSER forum as the file WANTIM.ZIP.


Software  : DOS Device Driver
Hardware  : Rugby Clock Receiver Kit
Source    : MSF Rugby

Supplier  : Maplin Electronics 
            PO Box 3,          
            Rayleigh, Essex  
			SS6 8LR 
			UK

Telephone : +44 702 552911

Provides software and hardware in kit form for DOS PCs to allow
synchronization to the MSF Rugby clock. Can be used with NSETTIME.EXE
to allow setting of the server time.

Software  : DOS Device Driver
Hardware  : DCF77 Clock
Source    : DCF77

Supplier  : Conrod Electronics   
            PO Box 12,         
            7500 AA Enschede  
			Netherlands

Tel       : +31 53 282000
Fax       : +31 53 283075

Provides software and hardware in kit or ready-built form for
DOS PCs to allow synchronization to the DCF77 Mainflingen clock.


Software  : NSETTIME.EXE
Hardware  : None
Source    : Workstation Time
Supplier  : Networth Inc, BBS

Tel       : +1 214 869 1331
Fax       : +1 214 556 0841
BBS       : +1 214 869 2959

Program available on Networth BBS which sets the File Server time
to the current workstation time. Can be used together with any
of the DOS time synchronization packages to set the time on one
or more file server.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© 2014 Novell