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
181ea34b
Commit
181ea34b
authored
Jul 21, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snapshot: add true subsecond timestamp and pad with zeroes (fix #9012)
The previous value was quite bogus.
parent
3328b21b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
src/video_output/snapshot.c
src/video_output/snapshot.c
+16
-24
No files found.
src/video_output/snapshot.c
View file @
181ea34b
...
...
@@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <dirent.h>
#include <time.h>
...
...
@@ -174,30 +175,21 @@ int vout_snapshot_SaveImage(char **name, int *sequential,
free
(
filename
);
}
}
else
{
struct
tm
curtime
;
time_t
lcurtime
=
time
(
NULL
)
;
if
(
!
localtime_r
(
&
lcurtime
,
&
curtime
))
{
const
unsigned
int
id
=
(
image
->
i_pts
/
100000
)
&
0xFFFFFF
;
msg_Warn
(
object
,
"failed to get current time. Falling back to legacy snapshot naming"
);
if
(
asprintf
(
&
filename
,
"%s"
DIR_SEP
"%s%u.%s"
,
cfg
->
path
,
prefix
,
id
,
cfg
->
format
)
<
0
)
filename
=
NULL
;
}
else
{
/* suffix with the last decimal digit in 10s of seconds resolution
* FIXME gni ? */
const
int
id
=
(
image
->
i_pts
/
(
100
*
1000
))
&
0xFF
;
char
buffer
[
128
];
if
(
!
strftime
(
buffer
,
sizeof
(
buffer
),
"%Y-%m-%d-%Hh%Mm%Ss"
,
&
curtime
))
strcpy
(
buffer
,
"error"
);
if
(
asprintf
(
&
filename
,
"%s"
DIR_SEP
"%s%s%1u.%s"
,
cfg
->
path
,
prefix
,
buffer
,
id
,
cfg
->
format
)
<
0
)
filename
=
NULL
;
}
struct
timeval
tv
;
struct
tm
curtime
;
char
buffer
[
128
];
gettimeofday
(
&
tv
,
NULL
);
if
(
localtime_r
(
&
tv
.
tv_sec
,
&
curtime
)
==
NULL
)
gmtime_r
(
&
tv
.
tv_sec
,
&
curtime
);
if
(
strftime
(
buffer
,
sizeof
(
buffer
),
"%Y-%m-%d-%Hh%Mm%Ss"
,
&
curtime
)
==
0
)
strcpy
(
buffer
,
"error"
);
if
(
asprintf
(
&
filename
,
"%s"
DIR_SEP
"%s%s%03lu.%s"
,
cfg
->
path
,
prefix
,
buffer
,
tv
.
tv_usec
/
1000
,
cfg
->
format
)
<
0
)
filename
=
NULL
;
}
free
(
prefix
);
}
else
{
...
...
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