Ignore:
Timestamp:
Dec 6, 2011, 10:00:10 AM (14 years ago)
Author:
Herwig Bauernfeind
Message:

Samba Server 3.5: Move fix for Ticket #182 to os2helper.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/utils/net_time.c

    r671 r672  
    2020#include "utils/net.h"
    2121
    22 #ifdef __OS2__
    23 #define INCL_DOSDATETIME   /* Date and time values */
    24 #define INCL_DOSERRORS     /* DOS error values */
    25 #include <os2.h>
    26 #endif
    27 
    2822/*
    2923  return the time on a server. This does not require any authentication
     
    9791                               tm->tm_min, tm->tm_year + 1900, tm->tm_sec);
    9892}
    99 
    100 #ifdef __OS2__
    101 /* set date/time on OS/2 */
    102 static int os2_setdatetime(time_t t)
    103 {
    104         struct tm *tm;
    105 
    106         tm = localtime(&t);
    107         if (!tm) {
    108                 return -1;
    109         }
    110 
    111         DATETIME   DateTime = {0};      /* Structure to hold date/time info.   */
    112         APIRET     rc       = NO_ERROR; /* Return code                         */
    113 
    114         rc = DosGetDateTime(&DateTime); /* Get current date/time to fill structure */
    115         if (rc != NO_ERROR) {
    116                 return rc;
    117         }
    118 
    119         DateTime.year    = (USHORT) ((BYTE) tm->tm_year+1900);
    120         DateTime.month   = (UCHAR) ((BYTE) tm->tm_mon+1);
    121         DateTime.day     = (UCHAR) ((BYTE) tm->tm_mday);
    122         DateTime.hours   = (UCHAR) ((BYTE) tm->tm_hour);
    123         DateTime.minutes = (UCHAR) ((BYTE) tm->tm_min);
    124         DateTime.seconds = (UCHAR) ((BYTE) tm->tm_sec);
    125 
    126         rc = DosSetDateTime(&DateTime);  /* Update the date and time */
    127 
    128         if (rc!= NO_ERROR) {
    129                 printf ("DosSetDateTime error : return code = %u\n", rc);
    130         }
    131         return rc;
    132 }
    133 #endif
    13493
    13594int net_time_usage(struct net_context *c, int argc, const char **argv)
Note: See TracChangeset for help on using the changeset viewer.