读取和修改计算机系统时间
2008-01-08 13:20
267 查看
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
...{
public ushort year;
public ushort month;
public ushort dayOfWeek;
public ushort day;
public ushort hour;
public ushort minute;
public ushort second;
public ushort milliseconds;
}
[DllImport("Kernel32.dll")]
public static extern void GetSystemTime([In, Out] SystemTime st);
[DllImport("Kernel32.dll")]
public static extern bool SetSystemTime([In, Out] SystemTime st);
SystemTime vSystemTime = new SystemTime();
GetSystemTime(vSystemTime); // 读
vSystemTime.year += 1;
SetSystemTime(vSystemTime); // 写
相关文章推荐
- ntp/系统时钟/硬件时钟/双系统下计算机时间读取的问题
- qt-读取和修改系统时间
- Android 为【apk】文件签名,增加修改系统时间等权限 推荐
- SDK自动化测试中利用python脚本修改手机系统时间
- asp.net 获得文件属性中的修改时间,获得系统文件属性的方法,最后一次写入时间
- 系统时间以及变量的修改,last,lsatlog,tty,wall write命令常用用法
- 修改jsp文件,访问时没有变化。可能是修改了系统的时间,,,郁闷呢
- Cookie的存储读取删除修改 (cookie.Expires读取永远是零时间)
- linux 修改系统时间
- 正确修改Linux的系统时间
- 时间的故事——浅谈计算机系统引导启动
- Linux 修改系统日期和时间
- 用“组策略”阻止病毒修改系统时间的方法
- linux修改系统时间
- C#简单读取、改变文件的创建、修改及访问时间的方法
- Linux下修改系统时间
- 由于系统时间修改导致Oracle启动失败
- windows环境C语言修改系统时间-WinAPI总结
- linux 修改系统时间
- 修改Linux下系统时间