diff options
| author | J Wyman <jeremy.wyman@microsoft.com> | 2015-03-26 18:10:24 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2015-04-28 14:25:02 -0400 |
| commit | 1920ee4ef6096f888a9bb19bc329424d2c7ee656 (patch) | |
| tree | c3c3c5f7c734440389d12da5a64158ed6e52e6e8 /src/win32/posix.h | |
| parent | 4c09e19a3764a1e5f3340dabf8104dfed32e7673 (diff) | |
| download | libgit2-1920ee4ef6096f888a9bb19bc329424d2c7ee656.tar.gz | |
Improvements to status performance on Windows.
Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
Diffstat (limited to 'src/win32/posix.h')
| -rw-r--r-- | src/win32/posix.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/win32/posix.h b/src/win32/posix.h index 4bc6bfe2e..1a1ae76b2 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -49,7 +49,15 @@ extern int p_ftruncate(int fd, git_off_t size); */ extern int p_lstat_posixly(const char *filename, struct stat *buf); -extern struct tm * p_localtime_r (const time_t *timer, struct tm *result); -extern struct tm * p_gmtime_r (const time_t *timer, struct tm *result); +extern struct tm * p_localtime_r(const time_t *timer, struct tm *result); +extern struct tm * p_gmtime_r(const time_t *timer, struct tm *result); + +GIT_INLINE(time_t) filetime_to_time_t(const FILETIME *ft) +{ + long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime; + winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */ + winTime /= 10000000; /* Nano to seconds resolution */ + return (time_t)winTime; +} #endif |
