equal
deleted
inserted
replaced
|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <3gplibrary/mp4config.h> |
|
17 #include "mp4currenttime.h" |
|
18 #include <time.h> |
|
19 |
|
20 |
|
21 /* |
|
22 * Function: |
|
23 * |
|
24 * mp4_i32 getCurrentTime(mp4_u32 *currentTime) |
|
25 * |
|
26 * Description: |
|
27 * |
|
28 * Calculate time in seconds since Jan 1st, 1970. |
|
29 * |
|
30 * Parameters: |
|
31 * |
|
32 * currentTime Time is returned here. |
|
33 * |
|
34 * Return value: |
|
35 * |
|
36 * 0 Success |
|
37 * -1 Error |
|
38 * |
|
39 */ |
|
40 mp4_i32 getCurrentTime(mp4_u32 *currentTime) |
|
41 { |
|
42 time_t ltime; |
|
43 |
|
44 /* Get time in seconds since Jan 1st, 1970 */ |
|
45 if (time(<ime) == -1) |
|
46 return -1; |
|
47 |
|
48 /* Convert time to start from Jan 1st, 1904 */ |
|
49 *currentTime = (mp4_u32)ltime + ((mp4_u32)66 * 365 + 17) * 24 * 3600; |
|
50 |
|
51 return 0; |
|
52 } |
|
53 |
|
54 // End of File |