home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
lan
/
srvtime
/
srvtime.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-01-05
|
2KB
|
58 lines
/* Program to set the default file server time to the setting of the
* attached workstation clock. Written by Alan Marshall, Proteon
* 1/5/89. The program is accurate to within about 2 seconds between
* setting and login to the server. The resolution seems to be in the
* setting algorithm within the file server. The program uses the
* SNIT.LIB routine from the 1988 Developer's Conference programs but
* requires a patch to the library file to change an instruction in the
* SetFileServerDateAndTime routine to make the year part work with the
* Advanced 2.11 server software. This patch can be made with debug
* by searching for the sequence: 80,C0,94. At that instruction (in the
* first segment) change the 94 to 00 and write out the lib file.
* The exe file supplied with this C source has the patch made. It can
* be made to the exe file after linking with snit.lib.
* Good luck!
* -Al Marshall
*/
#include <stdio.h>
#include <dos.h>
#include <time.h>
#include <nit.h>
main()
{
struct date today;
struct time now;
int tr_year;
char *str_now;
int ccode;
WORD year, month, day, hour, minute, second = 0;
getdate(&today);
tr_year = today.da_year % 100; /* truncate year to 2 digits */
gettime(&now);
/* now set the time in the default file server */
/* set words to values of current clock */
year = today.da_year % 100;
month = today.da_mon;
day = today.da_day;
hour = now.ti_hour;
minute = now.ti_min;
second = now.ti_sec;
ccode = SetFileServerDateAndTime (year, month, day, hour, minute, second);
if (ccode == 0)
{
printf ("Setting server time to:");
printf(" %02.2d/%02.2d/%02.2d",today.da_mon,today.da_day,tr_year);
printf(" %02.2d:%02.2d:%02.2d\n", now.ti_hour,now.ti_min,now.ti_sec);
}
else
printf("Operator class is not `CONSOLE', server time NOT set!");
}