move FileTimeToTime from sigar_os.h to win32_sigar.c
This commit is contained in:
		
							parent
							
								
									31dcf1bc48
								
							
						
					
					
						commit
						35a3672c31
					
				@ -45,17 +45,6 @@
 | 
			
		||||
 | 
			
		||||
#define SIGAR_CMDLINE_MAX 4096
 | 
			
		||||
 | 
			
		||||
static __inline sigar_uint64_t FileTimeToTime(FILETIME *ft)
 | 
			
		||||
{
 | 
			
		||||
    sigar_uint64_t time;
 | 
			
		||||
    time = ft->dwHighDateTime;
 | 
			
		||||
    time = time << 32;
 | 
			
		||||
    time |= ft->dwLowDateTime;
 | 
			
		||||
    time /= 10;
 | 
			
		||||
    time -= EPOCH_DELTA;
 | 
			
		||||
    return time;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* XXX: support CP_UTF8 ? */
 | 
			
		||||
 | 
			
		||||
#define SIGAR_A2W(lpa, lpw, bytes) \
 | 
			
		||||
@ -569,6 +558,8 @@ struct sigar_t {
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
sigar_uint64_t sigar_FileTimeToTime(FILETIME *ft);
 | 
			
		||||
 | 
			
		||||
int sigar_wsa_init(sigar_t *sigar);
 | 
			
		||||
 | 
			
		||||
int sigar_proc_exe_peb_get(sigar_t *sigar, HANDLE proc,
 | 
			
		||||
 | 
			
		||||
@ -122,6 +122,17 @@ typedef enum {
 | 
			
		||||
#define MS_LOOPBACK_ADAPTER "Microsoft Loopback Adapter"
 | 
			
		||||
#define NETIF_LA "la"
 | 
			
		||||
 | 
			
		||||
sigar_uint64_t sigar_FileTimeToTime(FILETIME *ft)
 | 
			
		||||
{
 | 
			
		||||
    sigar_uint64_t time;
 | 
			
		||||
    time = ft->dwHighDateTime;
 | 
			
		||||
    time = time << 32;
 | 
			
		||||
    time |= ft->dwLowDateTime;
 | 
			
		||||
    time /= 10;
 | 
			
		||||
    time -= EPOCH_DELTA;
 | 
			
		||||
    return time;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static DWORD perfbuf_init(sigar_t *sigar)
 | 
			
		||||
{
 | 
			
		||||
    if (!sigar->perfbuf) {
 | 
			
		||||
@ -1244,7 +1255,8 @@ SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (start_time.dwHighDateTime) {
 | 
			
		||||
        proctime->start_time = FileTimeToTime(&start_time) / 1000;
 | 
			
		||||
        proctime->start_time =
 | 
			
		||||
            sigar_FileTimeToTime(&start_time) / 1000;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        proctime->start_time = 0;
 | 
			
		||||
@ -3126,7 +3138,7 @@ static int get_logon_info(HKEY users,
 | 
			
		||||
    
 | 
			
		||||
    if (status == ERROR_SUCCESS) {
 | 
			
		||||
        FileTimeToLocalFileTime(&wtime, &wtime);
 | 
			
		||||
        who->time = FileTimeToTime(&wtime) / 1000000;
 | 
			
		||||
        who->time = sigar_FileTimeToTime(&wtime) / 1000000;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    size = sizeof(value);
 | 
			
		||||
@ -3334,7 +3346,7 @@ static int sigar_who_wts(sigar_t *sigar,
 | 
			
		||||
                                             &bytes))
 | 
			
		||||
        {
 | 
			
		||||
            who->time =
 | 
			
		||||
                FileTimeToTime(&station_info.ConnectTime) / 1000000;
 | 
			
		||||
                sigar_FileTimeToTime(&station_info.ConnectTime) / 1000000;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            who->time = 0;
 | 
			
		||||
 | 
			
		||||
@ -67,7 +67,10 @@
 | 
			
		||||
    memset(s, '\0', sizeof(*(s)))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef WIN32
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
sigar_uint64_t sigar_FileTimeToTime(FILETIME *ft);
 | 
			
		||||
#else
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -192,9 +195,9 @@ static void fillin_fileattrs(sigar_file_attrs_t *finfo,
 | 
			
		||||
{
 | 
			
		||||
    DWORD *sizes = &wininfo->nFileSizeHigh;
 | 
			
		||||
 | 
			
		||||
    finfo->atime = FileTimeToTime(&wininfo->ftLastAccessTime) / 1000;
 | 
			
		||||
    finfo->ctime = FileTimeToTime(&wininfo->ftCreationTime) / 1000;
 | 
			
		||||
    finfo->mtime = FileTimeToTime(&wininfo->ftLastWriteTime) / 1000;
 | 
			
		||||
    finfo->atime = sigar_FileTimeToTime(&wininfo->ftLastAccessTime) / 1000;
 | 
			
		||||
    finfo->ctime = sigar_FileTimeToTime(&wininfo->ftCreationTime) / 1000;
 | 
			
		||||
    finfo->mtime = sigar_FileTimeToTime(&wininfo->ftLastWriteTime) / 1000;
 | 
			
		||||
 | 
			
		||||
    finfo->size = (sigar_uint64_t)sizes[1];
 | 
			
		||||
    if (finfo->size < 0 || sizes[0]) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user