home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / NETCLB35.ZIP / NETCLB35.EXE / EXAMPLES / STIME.C < prev    next >
C/C++ Source or Header  |  1996-01-03  |  2KB  |  53 lines

  1. /***************************************************************************/
  2. /* File:             STIME.C                                               */
  3. /*                                                                         */
  4. /* Function:         Output current server date and time.                  */
  5. /*                                                                         */
  6. /* Usage:            stime                                                 */
  7. /*                                                                         */
  8. /* Functions Called: GetFileServerDateTime                                 */
  9. /*                   GetPreferredConnectionID                              */
  10. /*                   GetDefaultConnectionID                                */
  11. /*                   GetPrimaryConnectionID                                */
  12. /*                   SetPreferredConnectionID                              */
  13. /*                   ISShellLoaded                                         */
  14. /*                                                                         */
  15. /***************************************************************************/
  16. #include "netware.h"
  17. #include <stdio.h>
  18.  
  19. static char *days[] = { "Sunday" , "Monday" , "Tuesday" , "Wednesday" ,
  20.                         "Thursday" , "Friday" , "Saturday" };
  21. void main( void )
  22. {
  23. nw_time ctime;
  24. nw_date cdate;
  25. int h,m,s,d,mth,y,dow;
  26. int thisserver,prefserver;
  27.  
  28.    if (IsShellLoaded() != SUCCESS)
  29.    {
  30.       printf("*** No netware shell loaded ***\n");
  31.       return;
  32.    }
  33.  
  34.    if ((prefserver = GetPreferredConnectionID()) == 0)
  35.    {
  36.       if ((thisserver = GetDefaultConnectionID()) == 0)
  37.          thisserver = GetPrimaryConnectionID();
  38.       SetPreferredConnectionID( thisserver );
  39.    }  
  40.    else
  41.       thisserver = prefserver;
  42.  
  43.    GetFileServerDateTime(&ctime,&cdate,&dow);
  44.    
  45.    printf("Today is %s\n",days[dow]);
  46.    printf("%02.2d-%02.2d-%04.4d__%02.2d:%02.2d:%02.2d\n",
  47.           cdate.day,cdate.month,cdate.year,
  48.           ctime.hours,ctime.minutes,ctime.seconds);
  49.             
  50.    if (thisserver != prefserver)   /* reset preferred server */
  51.       SetPreferredConnectionID( prefserver );
  52. }
  53.