Changeset 673 for branches/samba-3.3.x/source/lib
- Timestamp:
- Dec 6, 2011, 10:01:12 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/lib/os2helper.c
r644 r673 1 /* This file contains helper functions for OS/2 - 2 do not try to compile on other platforms! */ 1 /* This file contains Samba helper functions for eComStation (OS/2) - 2 * do not try to compile on other platforms! 3 * 4 * Copyright (C) 2007-2011 5 * Silvan Scherrer 6 * Yuri Dario 7 * Paul Smedley 8 * Herwig Bauernfeind 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 3 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, see <http://www.gnu.org/licenses/>. 22 */ 3 23 4 24 #ifdef __OS2__ … … 10 30 #define INCL_DOSMISC 11 31 #define INCL_DOSMODULEMGR 32 #define INCL_DOSDATETIME 12 33 #define INCL_DOSERRORS 13 34 … … 16 37 #include <stdlib.h> 17 38 #include <errno.h> 39 #include <time.h> 18 40 #include <types.h> 19 41 #include <string.h> … … 503 525 } 504 526 527 /* set date/time on OS/2 */ 528 int os2_setdatetime(time_t t) 529 { 530 struct tm *tm; 531 532 tm = localtime(&t); 533 if (!tm) { 534 return -1; 535 } 536 537 DATETIME DateTime = {0}; 538 APIRET rc = NO_ERROR; 539 540 /* Get current date/time to properly fill structure */ 541 rc = DosGetDateTime(&DateTime); 542 if (rc != NO_ERROR) { 543 return rc; 544 } 545 546 DateTime.year = (USHORT) ((BYTE) tm->tm_year+1900); 547 DateTime.month = (UCHAR) ((BYTE) tm->tm_mon+1); 548 DateTime.day = (UCHAR) ((BYTE) tm->tm_mday); 549 DateTime.hours = (UCHAR) ((BYTE) tm->tm_hour); 550 DateTime.minutes = (UCHAR) ((BYTE) tm->tm_min); 551 DateTime.seconds = (UCHAR) ((BYTE) tm->tm_sec); 552 553 rc = DosSetDateTime(&DateTime); /* Update the date and time */ 554 555 if (rc!= NO_ERROR) { 556 printf ("DosSetDateTime error : return code = %u\n", rc); 557 } 558 return rc; 559 } 560 505 561 #endif
Note:
See TracChangeset
for help on using the changeset viewer.