Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
329c3ab2
Commit
329c3ab2
authored
Feb 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/FileInfo: use std::chrono::system_clock
parent
3b7f6641
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
10 deletions
+19
-10
PlaylistFile.cxx
src/PlaylistFile.cxx
+1
-1
SongUpdate.cxx
src/SongUpdate.cxx
+1
-1
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+2
-2
FileInfo.hxx
src/fs/FileInfo.hxx
+14
-5
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+1
-1
No files found.
src/PlaylistFile.cxx
View file @
329c3ab2
...
...
@@ -148,7 +148,7 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
return
false
;
info
.
name
=
std
::
move
(
name_utf8
);
info
.
mtime
=
fi
.
GetModificationTime
(
);
info
.
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
return
true
;
}
...
...
src/SongUpdate.cxx
View file @
329c3ab2
...
...
@@ -151,7 +151,7 @@ DetachedSong::LoadFile(Path path)
if
(
!
tag_file_scan
(
path
,
tag_builder
))
return
false
;
mtime
=
fi
.
GetModificationTime
(
);
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
tag_builder
.
Commit
(
tag
);
return
true
;
}
...
...
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
329c3ab2
...
...
@@ -157,7 +157,7 @@ SimpleDatabase::Load()
FileInfo
fi
;
if
(
GetFileInfo
(
path
,
fi
))
mtime
=
fi
.
GetModificationTime
(
);
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
}
void
...
...
@@ -358,7 +358,7 @@ SimpleDatabase::Save()
FileInfo
fi
;
if
(
GetFileInfo
(
path
,
fi
))
mtime
=
fi
.
GetModificationTime
(
);
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
}
void
...
...
src/fs/FileInfo.hxx
View file @
329c3ab2
...
...
@@ -24,14 +24,16 @@
#include "Path.hxx"
#include "system/Error.hxx"
#include <stdint.h>
#ifdef WIN32
#include <fileapi.h>
#else
#include <sys/stat.h>
#endif
#include <chrono>
#include <stdint.h>
#ifdef WIN32
static
inline
constexpr
uint64_t
...
...
@@ -47,6 +49,13 @@ FileTimeToTimeT(FILETIME ft)
-
116444736000000000
)
/
10000000
;
}
static
std
::
chrono
::
system_clock
::
time_point
FileTimeToChrono
(
FILETIME
ft
)
{
// TODO: eliminate the time_t roundtrip, preserve sub-second resolution
return
std
::
chrono
::
system_clock
::
from_time_t
(
FileTimeToTimeT
(
ft
));
}
#endif
class
FileInfo
{
...
...
@@ -100,11 +109,11 @@ public:
#endif
}
time_
t
GetModificationTime
()
const
{
std
::
chrono
::
system_clock
::
time_poin
t
GetModificationTime
()
const
{
#ifdef WIN32
return
FileTimeTo
TimeT
(
data
.
ftLastWriteTime
);
return
FileTimeTo
Chrono
(
data
.
ftLastWriteTime
);
#else
return
st
.
st_mtime
;
return
st
d
::
chrono
::
system_clock
::
from_time_t
(
st
.
st_mtime
)
;
#endif
}
...
...
src/storage/plugins/LocalStorage.cxx
View file @
329c3ab2
...
...
@@ -86,7 +86,7 @@ Stat(Path path, bool follow)
info
.
type
=
StorageFileInfo
::
Type
::
OTHER
;
info
.
size
=
src
.
GetSize
();
info
.
mtime
=
s
rc
.
GetModificationTime
(
);
info
.
mtime
=
s
td
::
chrono
::
system_clock
::
to_time_t
(
src
.
GetModificationTime
()
);
#ifdef WIN32
info
.
device
=
info
.
inode
=
0
;
#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