这恐怕谁都没有办法的
就算你在程序中实现了
他在CMOS改你也没有办法。

解决方案 »

  1.   

    可以取服务器时间啊~~
    NTRemote DateTime:
    部分关键代码:
      PTime_Of_Day_Info = ^TTime_Of_Day_Info;
      TTime_Of_Day_Info = record
        tod_elapsedt  :Integer;
        tod_msecs     :Integer;
        tod_hours     :Integer;
        tod_mins      :Integer;
        tod_secs      :Integer;
        tod_hunds     :Integer;
        tod_timezone  :LongInt;
        tod_tinterval :Integer;
        tod_day       :Integer;
        tod_month     :Integer;
        tod_year      :Integer;
        tod_weekday   :Integer;
      end;function NetRemoteTOD(ServerName :PWideChar;
                            var buffer :pointer) :Integer; stdcall; external 'netapi32.dll';function NetApiBufferFree(buffer : Pointer) :Integer; stdcall; external 'netapi32.dll';function TNTRemoteDateTime.GetTOD(ServerName: WideString): Integer;
    var Buffer     :pointer;
        Rek        :PTime_Of_Day_Info;
        ADate      :TDateTime;
        ATime      :TDateTime;
        FinalTime  :TDateTime;
        THours,
        TMins,
        TSecs,
        TMSecs     :Word;
        TYear,
        TMonth,
        TDay       :Word;
    begin  result:=NetRemoteTOD(PWideChar(ServerName),
                           Buffer);
      if result=0 then
      begin
        Rek:=PTime_Of_Day_Info(Buffer);
        FServerName :=ServerName;
        FElapseDt   :=Rek.tod_elapsedt;
        FMSecs      :=Rek.tod_msecs;
        FHours      :=Rek.tod_hours;
        FMins       :=Rek.tod_mins;
        FSecs       :=Rek.tod_secs;
        FHunds      :=Rek.tod_hunds;
        FTInterval  :=Rek.tod_tinterval;    If Rek.tod_timezone <> -1 then
        begin
          FTimeZone:=Rek.tod_timezone div 60;
        end
        else
          FTimeZone:=0;    FDay        :=Rek.tod_day;
        FMonth      :=Rek.tod_month;
        FYear       :=Rek.tod_year;
        FWeekDay    :=Rek.tod_weekday;    ADate:=EncodeDate(FYear, FMonth, FDay);
        ATime:=EnCodeTime(FHours, FMins, FSecs, FHunds);    FinalTime:=StrToDateTime(DateTimeToStr(ADate) + ' ' + TimeToStr(ATime));
        FinalTime:=FinalTime - (FTimeZone / 24);    decodetime(FinalTime,THours, TMins,TSecs, TSecs);    FHours:=Integer(THours);    decodeDate(FinalTime,TYear, TMonth,TDay);
        FYear:=Integer(TYear);
        FMonth:=Integer(TMonth);
        FDay:=Integer(TDay);  end;
      NetApiBufferFree(Buffer);
    end;
      

  2.   

    这个也是一种方案
    procedure AnsyTime(const DatabaseName:string);
    var
      td: _SYSTEMTIME;
      ft: FILETIME;
    begin
    { DONE -oKingron -cOther : 同步服务器时间 }
      with TQuery.Create(Self) do
      try
        DatabaseName:=DatabaseName;
        SQL.Clear;
        SQL.Text := 'select td=getdate()';
        Open;
        DateTimeToSystemTime(FieldByName('td').AsDateTime, td);
        SystemTimeToFileTime(td,ft);
        LocalFileTimeToFileTime(ft,ft);
        FileTimeToSystemTime(ft,td);
        SetSystemTime(td);
      finally
        Free;
      end;
    end;
      

  3.   

    NetRemoteTOD:
    type
     TIME_OF_DAY_INFO=record
        tod_elapsedt:DWORD;
        tod_msecs:dword;
        tod_hours:dword;
        tod_mins:dword;
        tod_secs:dword;
        tod_hunds:dword;
        tod_timezone:longint;
        tod_tinterval:dword;
        tod_day:dword;
        tod_month:dword;
        tod_year:dword;
        tod_weekday:dword;
     end;procedure NetRemoteTOD(UncServerName:lptstr;var BufferPtr:TIME_OF_DAY_INFO);stdcall;external 'netapi.dll';
    如果第一个参数为Nil,则从本地机器取得时间。
    只能在NT上面使用!
      

  4.   

    wylove(阿刚) 的方案也不错
    很容易实现
    不过似乎系统开销很大