Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
c3a6fcf1
Commit
c3a6fcf1
authored
Feb 11, 2007
by
Christophe Mutricy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gettimeofday() implementaion for Win32. Leverage from tcpdump mailing list.
parent
85b0d984
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
THANKS
THANKS
+1
-0
src/misc/mtime.c
src/misc/mtime.c
+44
-2
No files found.
THANKS
View file @
c3a6fcf1
...
@@ -70,6 +70,7 @@ François Seingier <francois.seingier at club-internet.fr> - TTL setting in the
...
@@ -70,6 +70,7 @@ François Seingier <francois.seingier at club-internet.fr> - TTL setting in the
Frank Chao <frank0624 at gmail.com> - Chinese Traditional translation
Frank Chao <frank0624 at gmail.com> - Chinese Traditional translation
Fumio Nakayama <endymion at ca2.so-net.ne.jp> - Japanese translation
Fumio Nakayama <endymion at ca2.so-net.ne.jp> - Japanese translation
Georgi Chorbadzhiyski <gf at unixsol dot org> - HTTP access error handling fix
Georgi Chorbadzhiyski <gf at unixsol dot org> - HTTP access error handling fix
Gisle Vanem <giva at bgnet dot no> - gettieoffay under win32
Greg Farrell <greg at gregfarell dot org> - rc interface "enqueue" command
Greg Farrell <greg at gregfarell dot org> - rc interface "enqueue" command
Gregory Hazel <ghazel at gmail dot com> - wxWidgets fixes and improvements
Gregory Hazel <ghazel at gmail dot com> - wxWidgets fixes and improvements
Goetz Waschk <waschk at informatik.uni-rostock dot de> - Mandrake packages
Goetz Waschk <waschk at informatik.uni-rostock dot de> - Mandrake packages
...
...
src/misc/mtime.c
View file @
c3a6fcf1
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
* mtime.c: high resolution time management functions
* mtime.c: high resolution time management functions
* Functions are prototyped in vlc_mtime.h.
* Functions are prototyped in vlc_mtime.h.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998-200
4
the VideoLAN team
* Copyright (C) 1998-200
7
the VideoLAN team
* Copyright © 2006-2007 Rémi Denis-Courmont
* Copyright © 2006-2007 Rémi Denis-Courmont
* $Id$
* $Id$
*
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Rémi Denis-Courmont <rem$videolan,org>
* Rémi Denis-Courmont <rem$videolan,org>
* Gisle Vanem
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -54,7 +55,7 @@
...
@@ -54,7 +55,7 @@
# include <sys/time.h>
# include <sys/time.h>
#endif
#endif
#if
defined(HAVE_NANOSLEEP) &&
!defined(HAVE_STRUCT_TIMESPEC)
#if !defined(HAVE_STRUCT_TIMESPEC)
struct
timespec
struct
timespec
{
{
time_t
tv_sec
;
time_t
tv_sec
;
...
@@ -389,6 +390,47 @@ mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
...
@@ -389,6 +390,47 @@ mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
return
p_date
->
date
;
return
p_date
->
date
;
}
}
#ifdef WIN32
/*
* Number of micro-seconds between the beginning of the Windows epoch
* (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970).
*
* This assumes all Win32 compilers have 64-bit support.
*/
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) || defined(__WATCOMC__)
# define DELTA_EPOCH_IN_USEC 11644473600000000Ui64
#else
# define DELTA_EPOCH_IN_USEC 11644473600000000ULL
#endif
static
uint64_t
filetime_to_unix_epoch
(
const
FILETIME
*
ft
)
{
uint64_t
res
=
(
uint64_t
)
ft
->
dwHighDateTime
<<
32
;
res
|=
ft
->
dwLowDateTime
;
res
/=
10
;
/* from 100 nano-sec periods to usec */
res
-=
DELTA_EPOCH_IN_USEC
;
/* from Win epoch to Unix epoch */
return
(
res
);
}
static
int
gettimeofday
(
struct
timeval
*
tv
,
void
*
tz
)
{
FILETIME
ft
;
uint64_t
tim
;
if
(
!
tv
)
{
return
VLC_EGENERIC
;
}
GetSystemTimeAsFileTime
(
&
ft
);
tim
=
filetime_to_unix_epoch
(
&
ft
);
tv
->
tv_sec
=
(
long
)
(
tim
/
1000000L
);
tv
->
tv_usec
=
(
long
)
(
tim
%
1000000L
);
return
(
0
);
}
#endif
/**
/**
* @return NTP 64-bits timestamp in host byte order.
* @return NTP 64-bits timestamp in host byte order.
*/
*/
...
...
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