Alexandre Julliard : server:
Convert the server start time to the abs_time_t type.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 26 09:00:47 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: c627601c3bc2e09a413978819985c51048c20cca
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c627601c3bc2e09a413978819985c51048c20cca
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 26 14:50:55 2006 +0200
server: Convert the server start time to the abs_time_t type.
---
dlls/ntdll/nt.c | 2 +-
dlls/ntdll/ntdll_misc.h | 2 +-
dlls/ntdll/server.c | 2 +-
dlls/ntdll/time.c | 6 ++++--
include/wine/server_protocol.h | 4 ++--
server/object.h | 2 +-
server/protocol.def | 2 +-
server/request.c | 7 ++++---
server/thread.c | 3 ++-
server/trace.c | 4 +++-
10 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index fea63e3..8bc3ff8 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -683,7 +683,7 @@ NTSTATUS WINAPI NtQuerySystemInformation
memset(&sti, 0 , sizeof(sti));
/* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
- RtlSecondsSince1970ToTime( server_start_time, &sti.liKeBootTime );
+ NTDLL_from_server_abstime( &sti.liKeBootTime, &server_start_time );
if (Length <= sizeof(sti))
{
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 0232086..03110a4 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -54,7 +54,7 @@ extern void virtual_init(void);
extern void virtual_init_threading(void);
/* server support */
-extern time_t server_start_time;
+extern abs_time_t server_start_time;
extern void server_init_process(void);
extern size_t server_init_thread( int unix_pid, int unix_tid, void *entry_point );
extern void DECLSPEC_NORETURN server_protocol_error( const char *err, ... );
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index d6d18e0..841604a 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -85,7 +85,7 @@ struct cmsg_fd
};
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
-time_t server_start_time = 0; /* time of server startup */
+abs_time_t server_start_time = { 0, 0 }; /* time of server startup */
extern struct wine_pthread_functions pthread_functions;
diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c
index e83da76..54d4adc 100644
--- a/dlls/ntdll/time.c
+++ b/dlls/ntdll/time.c
@@ -874,7 +874,8 @@ NTSTATUS WINAPI NtQueryPerformanceCounte
* to one of 1.193182 MHz, with some care for arithmetic
* overflow ( will not overflow for 5000 years ) and
* good accuracy ( 105/88 = 1.19318182) */
- Counter->QuadPart = (((now.tv_sec - server_start_time) * (ULONGLONG)1000000 + now.tv_usec) * 105) / 88;
+ Counter->QuadPart = (((now.tv_sec - server_start_time.sec) * (ULONGLONG)1000000 +
+ (now.tv_usec - server_start_time.usec)) * 105) / 88;
if (Frequency) Frequency->QuadPart = 1193182;
return STATUS_SUCCESS;
}
@@ -889,7 +890,8 @@ ULONG WINAPI NtGetTickCount(void)
struct timeval current_time;
gettimeofday(¤t_time, NULL);
- return (current_time.tv_sec - server_start_time)*1000 + current_time.tv_usec/1000;
+ return (current_time.tv_sec - server_start_time.sec) * 1000 +
+ (current_time.tv_usec - server_start_time.usec) / 1000;
}
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 1c128e2..15b18cd 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -299,7 +299,7 @@ struct init_thread_reply
process_id_t pid;
thread_id_t tid;
data_size_t info_size;
- time_t server_start;
+ abs_time_t server_start;
int version;
};
@@ -4385,6 +4385,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
-#define SERVER_PROTOCOL_VERSION 242
+#define SERVER_PROTOCOL_VERSION 243
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/object.h b/server/object.h
index 46b34e1..1a75e4c 100644
--- a/server/object.h
+++ b/server/object.h
@@ -213,6 +213,6 @@ extern int foreground;
extern const char *server_argv0;
/* server start time used for GetTickCount() */
-extern time_t server_start_time;
+extern struct timeval server_start_time;
#endif /* __WINE_SERVER_OBJECT_H */
diff --git a/server/protocol.def b/server/protocol.def
index 6910ed4..e64cf43 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -284,7 +284,7 @@ struct token_groups
process_id_t pid; /* process id of the new thread's process */
thread_id_t tid; /* thread id of the new thread */
data_size_t info_size; /* total size of startup info */
- time_t server_start; /* server start time */
+ abs_time_t server_start; /* server start time */
int version; /* protocol version */
@END
diff --git a/server/request.c b/server/request.c
index 6fc7fcb..d0e1a88 100644
--- a/server/request.c
+++ b/server/request.c
@@ -114,7 +114,7 @@ static const struct fd_ops master_socket
struct thread *current = NULL; /* thread handling the current request */
unsigned int global_error = 0; /* global error code for when no thread is current */
-time_t server_start_time = 0; /* server startup time */
+struct timeval server_start_time = { 0, 0 }; /* server startup time */
static struct master_socket *master_socket; /* the master socket object */
@@ -465,7 +465,8 @@ unsigned int get_tick_count(void)
{
struct timeval t;
gettimeofday( &t, NULL );
- return ((t.tv_sec - server_start_time) * 1000) + (t.tv_usec / 1000);
+ return ((t.tv_sec - server_start_time.tv_sec) * 1000) +
+ ((t.tv_usec - server_start_time.tv_usec) / 1000);
}
static void master_socket_dump( struct object *obj, int verbose )
@@ -798,7 +799,7 @@ void open_master_socket(void)
msghdr.msg_iovlen = 1;
/* init startup time */
- server_start_time = time(NULL);
+ gettimeofday( &server_start_time, NULL );
}
/* master socket timer expiration handler */
diff --git a/server/thread.c b/server/thread.c
index 23508d3..feb3259 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -889,7 +889,8 @@ DECL_HANDLER(init_thread)
reply->pid = get_process_id( process );
reply->tid = get_thread_id( current );
reply->version = SERVER_PROTOCOL_VERSION;
- reply->server_start = server_start_time;
+ reply->server_start.sec = server_start_time.tv_sec;
+ reply->server_start.usec = server_start_time.tv_usec;
return;
error:
diff --git a/server/trace.c b/server/trace.c
index ee3db8b..574943a 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -697,7 +697,9 @@ static void dump_init_thread_reply( cons
fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " info_size=%u,", req->info_size );
- fprintf( stderr, " server_start=%ld,", (long)req->server_start );
+ fprintf( stderr, " server_start=" );
+ dump_abs_time( &req->server_start );
+ fprintf( stderr, "," );
fprintf( stderr, " version=%d", req->version );
}
More information about the wine-cvs
mailing list