home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************/
- /* File: STIME.C */
- /* */
- /* Function: Output current server date and time. */
- /* */
- /* Usage: stime */
- /* */
- /* Functions Called: GetFileServerDateTime */
- /* GetPreferredConnectionID */
- /* GetDefaultConnectionID */
- /* GetPrimaryConnectionID */
- /* SetPreferredConnectionID */
- /* ISShellLoaded */
- /* */
- /***************************************************************************/
- #include "netware.h"
- #include <stdio.h>
-
- static char *days[] = { "Sunday" , "Monday" , "Tuesday" , "Wednesday" ,
- "Thursday" , "Friday" , "Saturday" };
- void main( void )
- {
- nw_time ctime;
- nw_date cdate;
- int h,m,s,d,mth,y,dow;
- int thisserver,prefserver;
-
- if (IsShellLoaded() != SUCCESS)
- {
- printf("*** No netware shell loaded ***\n");
- return;
- }
-
- if ((prefserver = GetPreferredConnectionID()) == 0)
- {
- if ((thisserver = GetDefaultConnectionID()) == 0)
- thisserver = GetPrimaryConnectionID();
- SetPreferredConnectionID( thisserver );
- }
- else
- thisserver = prefserver;
-
- GetFileServerDateTime(&ctime,&cdate,&dow);
-
- printf("Today is %s\n",days[dow]);
- printf("%02.2d-%02.2d-%04.4d__%02.2d:%02.2d:%02.2d\n",
- cdate.day,cdate.month,cdate.year,
- ctime.hours,ctime.minutes,ctime.seconds);
-
- if (thisserver != prefserver) /* reset preferred server */
- SetPreferredConnectionID( prefserver );
- }
-