Benny Prijono | e722461 | 2005-11-13 19:40:44 +0000 | [diff] [blame^] | 1 | /* $Id$
|
| 2 | *
|
| 3 | */
|
| 4 | /*
|
| 5 | * PJLIB - PJ Foundation Library
|
| 6 | * (C)2003-2005 Benny Prijono <bennylp@bulukucing.org>
|
| 7 | *
|
| 8 | * Author:
|
| 9 | * Benny Prijono <bennylp@bulukucing.org>
|
| 10 | *
|
| 11 | * This library is free software; you can redistribute it and/or
|
| 12 | * modify it under the terms of the GNU Lesser General Public
|
| 13 | * License as published by the Free Software Foundation; either
|
| 14 | * version 2.1 of the License, or (at your option) any later version.
|
| 15 | *
|
| 16 | * This library is distributed in the hope that it will be useful,
|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 19 | * Lesser General Public License for more details.
|
| 20 | *
|
| 21 | * You should have received a copy of the GNU Lesser General Public
|
| 22 | * License along with this library; if not, write to the Free Software
|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 24 | */
|
| 25 | /* $Log: /pjproject-0.3/pjlib/src/pj/os_time_linux_kernel.c $
|
| 26 | *
|
| 27 | * 2 10/14/05 12:26a Bennylp
|
| 28 | * Finished error code framework, some fixes in ioqueue, etc. Pretty
|
| 29 | * major.
|
| 30 | *
|
| 31 | * 1 9/22/05 10:39a Bennylp
|
| 32 | * Created.
|
| 33 | *
|
| 34 | */
|
| 35 | #include <pj/os.h>
|
| 36 | #include <linux/time.h>
|
| 37 |
|
| 38 | ///////////////////////////////////////////////////////////////////////////////
|
| 39 |
|
| 40 | PJ_DEF(pj_status_t) pj_gettimeofday(pj_time_val *tv)
|
| 41 | {
|
| 42 | struct timeval tval;
|
| 43 |
|
| 44 | do_gettimeofday(&tval);
|
| 45 | tv->sec = tval.tv_sec;
|
| 46 | tv->msec = tval.tv_usec / 1000;
|
| 47 |
|
| 48 | return 0;
|
| 49 | }
|
| 50 |
|
| 51 | PJ_DEF(pj_status_t) pj_time_decode(const pj_time_val *tv, pj_parsed_time *pt)
|
| 52 | {
|
| 53 | pt->year = 2005;
|
| 54 | pt->mon = 8;
|
| 55 | pt->day = 20;
|
| 56 | pt->hour = 16;
|
| 57 | pt->min = 30;
|
| 58 | pt->sec = 30;
|
| 59 | pt->wday = 3;
|
| 60 | pt->yday = 200;
|
| 61 | pt->msec = 777;
|
| 62 |
|
| 63 | return -1;
|
| 64 | }
|
| 65 |
|
| 66 | /**
|
| 67 | * Encode parsed time to time value.
|
| 68 | */
|
| 69 | PJ_DEF(pj_status_t) pj_time_encode(const pj_parsed_time *pt, pj_time_val *tv);
|
| 70 |
|
| 71 | /**
|
| 72 | * Convert local time to GMT.
|
| 73 | */
|
| 74 | PJ_DEF(pj_status_t) pj_time_local_to_gmt(pj_time_val *tv);
|
| 75 |
|
| 76 | /**
|
| 77 | * Convert GMT to local time.
|
| 78 | */
|
| 79 | PJ_DEF(pj_status_t) pj_time_gmt_to_local(pj_time_val *tv);
|
| 80 |
|
| 81 |
|