Changeset 3709 for branches/libc-0.6
- Timestamp:
- Mar 17, 2011, 2:00:53 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/src/lib/sys/b_time.c
r1972 r3709 7 7 * 8 8 * 9 * This file is part of k Build.9 * This file is part of kLIBC. 10 10 * 11 * k Buildis free software; you can redistribute it and/or modify11 * kLIBC is free software; you can redistribute it and/or modify 12 12 * it under the terms of the GNU General Public License as published by 13 13 * the Free Software Foundation; either version 2 of the License, or 14 14 * (at your option) any later version. 15 15 * 16 * k Buildis distributed in the hope that it will be useful,16 * kLIBC is distributed in the hope that it will be useful, 17 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the … … 20 20 * 21 21 * You should have received a copy of the GNU General Public License 22 * along with k Build; if not, write to the Free Software22 * along with kLIBC; if not, write to the Free Software 23 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 * 25 25 */ 26 27 26 28 27 /******************************************************************************* … … 34 33 #include "b_time.h" 35 34 #include <time.h> 35 #include <emx/time.h> 36 36 37 37 … … 46 46 { 47 47 struct tm Tm; 48 49 if (!_tzset_flag) 50 tzset(); 48 51 gmtime_r(&Time, &Tm); 49 #if 0 /* This didn't work in GCC versions <= 2.4 */ 50 time->twosecs = Tm.tm_sec / 2; 51 time->minutes = Tm.tm_min; 52 time->hours = Tm.tm_hour; 53 date->day = Tm.tm_mday; 54 date->month = Tm.tm_mon + 1; 55 date->year = Tm.tm_year - 1980 + 1900; 56 #else 57 USHORT us = (Tm.tm_sec / 2) + (Tm.tm_min << 5) + (Tm.tm_hour << 11); 58 *(PUSHORT)pTime = us; 59 us = Tm.tm_mday + ((Tm.tm_mon + 1) << 5) + ((Tm.tm_year - 80) << 9); 60 *(PUSHORT)pDate = us; 61 #endif 52 53 if (Tm.tm_year >= 80) 54 { 55 pTime->twosecs = Tm.tm_sec / 2; 56 pTime->minutes = Tm.tm_min; 57 pTime->hours = Tm.tm_hour; 58 pDate->day = Tm.tm_mday; 59 pDate->month = Tm.tm_mon + 1; 60 pDate->year = Tm.tm_year - 1980 + 1900; 61 } 62 else 63 { 64 pTime->twosecs = 0; 65 pTime->minutes = 0; 66 pTime->hours = 0; 67 pDate->day = 1; 68 pDate->month = 1; 69 pDate->year = 0; 70 } 62 71 } 63 72
Note:
See TracChangeset
for help on using the changeset viewer.