Changeset 338 for pjproject/trunk/pjlib/src/pj/os_time_bsd.c
- Timestamp:
- Mar 20, 2006 12:39:24 PM (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_time_bsd.c
r337 r338 34 34 } 35 35 36 PJ_DEF(pj_status_t) pj_time_decode(const pj_time_val *tv, pj_parsed_time *pt)37 {38 struct tm *local_time;39 40 PJ_CHECK_STACK();41 42 local_time = localtime((time_t*)&tv->sec);43 44 pt->year = local_time->tm_year+1900;45 pt->mon = local_time->tm_mon;46 pt->day = local_time->tm_mday;47 pt->hour = local_time->tm_hour;48 pt->min = local_time->tm_min;49 pt->sec = local_time->tm_sec;50 pt->wday = local_time->tm_wday;51 pt->msec = tv->msec;52 53 return PJ_SUCCESS;54 }55 56 /**57 * Encode parsed time to time value.58 */59 PJ_DEF(pj_status_t) pj_time_encode(const pj_parsed_time *pt, pj_time_val *tv)60 {61 struct tm local_time;62 63 local_time.tm_year = pt->year-1900;64 local_time.tm_mon = pt->mon;65 local_time.tm_mday = pt->day;66 local_time.tm_hour = pt->hour;67 local_time.tm_min = pt->min;68 local_time.tm_sec = pt->sec;69 local_time.tm_isdst = 0;70 71 tv->sec = mktime(&local_time);72 tv->msec = pt->msec;73 74 return PJ_SUCCESS;75 }76 77 /**78 * Convert local time to GMT.79 */80 PJ_DEF(pj_status_t) pj_time_local_to_gmt(pj_time_val *tv);81 82 /**83 * Convert GMT to local time.84 */85 PJ_DEF(pj_status_t) pj_time_gmt_to_local(pj_time_val *tv);86 87
Note: See TracChangeset
for help on using the changeset viewer.