Changeset 672
- Timestamp:
- Dec 6, 2011, 10:00:10 AM (14 years ago)
- Location:
- trunk/server/source3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/lib/os2helper.c
r664 r672 6 6 * Yuri Dario 7 7 * Paul Smedley 8 * Herwig Bauernfeind 8 9 * 9 10 * This program is free software; you can redistribute it and/or modify … … 29 30 #define INCL_DOSMISC 30 31 #define INCL_DOSMODULEMGR 32 #define INCL_DOSDATETIME 31 33 #define INCL_DOSERRORS 32 34 … … 35 37 #include <stdlib.h> 36 38 #include <errno.h> 39 #include <time.h> 37 40 #include <types.h> 38 41 #include <string.h> … … 558 561 } 559 562 563 /* set date/time on OS/2 */ 564 int os2_setdatetime(time_t t) 565 { 566 struct tm *tm; 567 568 tm = localtime(&t); 569 if (!tm) { 570 return -1; 571 } 572 573 DATETIME DateTime = {0}; 574 APIRET rc = NO_ERROR; 575 576 /* Get current date/time to properly fill structure */ 577 rc = DosGetDateTime(&DateTime); 578 if (rc != NO_ERROR) { 579 return rc; 580 } 581 582 DateTime.year = (USHORT) ((BYTE) tm->tm_year+1900); 583 DateTime.month = (UCHAR) ((BYTE) tm->tm_mon+1); 584 DateTime.day = (UCHAR) ((BYTE) tm->tm_mday); 585 DateTime.hours = (UCHAR) ((BYTE) tm->tm_hour); 586 DateTime.minutes = (UCHAR) ((BYTE) tm->tm_min); 587 DateTime.seconds = (UCHAR) ((BYTE) tm->tm_sec); 588 589 rc = DosSetDateTime(&DateTime); /* Update the date and time */ 590 591 if (rc!= NO_ERROR) { 592 printf ("DosSetDateTime error : return code = %u\n", rc); 593 } 594 return rc; 595 } 596 560 597 #endif -
trunk/server/source3/utils/net_time.c
r671 r672 20 20 #include "utils/net.h" 21 21 22 #ifdef __OS2__23 #define INCL_DOSDATETIME /* Date and time values */24 #define INCL_DOSERRORS /* DOS error values */25 #include <os2.h>26 #endif27 28 22 /* 29 23 return the time on a server. This does not require any authentication … … 97 91 tm->tm_min, tm->tm_year + 1900, tm->tm_sec); 98 92 } 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 #endif134 93 135 94 int net_time_usage(struct net_context *c, int argc, const char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.