请教一个以前有人问过的问题:如何从CLIENT端获取SERVER端的系统时间?

Judas 2000-04-25 11:29:00
程序需要加入一个日志记录,需要记录每项操作的时间和内容,为保证时间的统一,欲取SERVER端的系统时间,如何在程序中做到这一点?
...全文
178 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Judas 2000-04-25
  • 打赏
  • 举报
回复
补充:SERVER端数据库为SYBASE。
请教huitor:SYBASE 中的读取服务器系统时间的方法是什么?
huitor 2000-04-25
  • 打赏
  • 举报
回复
1、假设利用数据库,很容易实现。多数数据库提供了读取服务器系统时间的方法。如MS SQL SERVER,可以通过getdate()来实现。
2、自己编写一个Socket程序,提供时间服务。客户端发出请求读取服务器时间。
3、好象有Time Server,只要安装之后,工作站和服务器时间能够同步。此时只需读客户机时间即可。
光明山人 2000-04-25
  • 打赏
  • 举报
回复
Sybase也是: select GetDate();

用API取:
The NetRemoteTOD function returns the time of day information from a specified server.

Security Requirements

No special group membership is required to successfully execute NetRemoteTOD.

NET_API_STATUS NetRemoteTOD(

LPTSTR UncServerName,
LPBYTE *BufferPtr
);


Parameters

UncServerName

Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.

BufferPtr

On return a pointer to the return information structure TIME_OF_DAY_INFO is returned in the address pointed to by BufferPtr.

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧