Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
adba759f
Commit
adba759f
authored
Dec 10, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adaptive: use timegm()
parent
903664b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
27 deletions
+14
-27
modules/demux/adaptative/tools/Conversions.cpp
modules/demux/adaptative/tools/Conversions.cpp
+14
-27
No files found.
modules/demux/adaptative/tools/Conversions.cpp
View file @
adba759f
...
@@ -91,29 +91,6 @@ IsoTime::operator time_t () const
...
@@ -91,29 +91,6 @@ IsoTime::operator time_t () const
return
time
;
return
time
;
}
}
/* i_year: year - 1900 i_month: 0-11 i_mday: 1-31 i_hour: 0-23 i_minute: 0-59 i_second: 0-59 */
static
int64_t
vlc_timegm
(
int
i_year
,
int
i_month
,
int
i_mday
,
int
i_hour
,
int
i_minute
,
int
i_second
)
{
static
const
int
pn_day
[
12
+
1
]
=
{
0
,
31
,
59
,
90
,
120
,
151
,
181
,
212
,
243
,
273
,
304
,
334
};
int64_t
i_day
;
if
(
i_year
<
70
||
i_month
<
0
||
i_month
>
11
||
i_mday
<
1
||
i_mday
>
31
||
i_hour
<
0
||
i_hour
>
23
||
i_minute
<
0
||
i_minute
>
59
||
i_second
<
0
||
i_second
>
59
)
return
-
1
;
/* Count the number of days */
i_day
=
(
int64_t
)
365
*
(
i_year
-
70
)
+
pn_day
[
i_month
]
+
i_mday
-
1
;
#define LEAP(y) ( ((y)%4) == 0 && (((y)%100) != 0 || ((y)%400) == 0) ? 1 : 0)
for
(
int
i
=
70
;
i
<
i_year
;
i
++
)
i_day
+=
LEAP
(
1900
+
i
);
if
(
i_month
>
1
)
i_day
+=
LEAP
(
1900
+
i_year
);
#undef LEAP
/**/
return
((
24
*
i_day
+
i_hour
)
*
60
+
i_minute
)
*
60
+
i_second
;
}
UTCTime
::
UTCTime
(
const
std
::
string
&
str
)
UTCTime
::
UTCTime
(
const
std
::
string
&
str
)
{
{
enum
{
YEAR
=
0
,
MON
,
DAY
,
HOUR
,
MIN
,
SEC
,
MSEC
,
TZ
};
enum
{
YEAR
=
0
,
MON
,
DAY
,
HOUR
,
MIN
,
SEC
,
MSEC
,
TZ
};
...
@@ -166,11 +143,21 @@ UTCTime::UTCTime(const std::string &str)
...
@@ -166,11 +143,21 @@ UTCTime::UTCTime(const std::string &str)
}
}
}
}
t
=
vlc_timegm
(
values
[
YEAR
]
-
1900
,
values
[
MON
]
-
1
,
values
[
DAY
],
struct
tm
tm
;
values
[
HOUR
],
values
[
MIN
],
values
[
SEC
]
);
tm
.
tm_year
=
values
[
YEAR
]
-
1900
;
tm
.
tm_mon
=
values
[
MON
]
-
1
;
tm
.
tm_mday
=
values
[
DAY
];
tm
.
tm_hour
=
values
[
HOUR
];
tm
.
tm_min
=
values
[
MIN
];
tm
.
tm_sec
=
values
[
SEC
];
tm
.
tm_isdst
=
0
;
t
=
timegm
(
&
tm
);
t
+=
values
[
TZ
]
*
60
;
t
+=
values
[
TZ
]
*
60
;
t
*=
CLOCK_FREQ
;
t
*=
1000
;
t
+=
values
[
MSEC
]
*
1000
;
t
+=
values
[
MSEC
];
t
*=
CLOCK_FREQ
/
1000
;
}
catch
(
int
)
{
}
catch
(
int
)
{
t
=
0
;
t
=
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment