🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13987

Re: Set System Date/Time

#13987
From: Remy Lebeau (TeamB)
Date: Mon, 01 Sep 2003 20:06
26 lines
1793 bytes
"Mike Shultz" <no@where.com> wrote in message
news:3f531c07@newsgroups.borland.com...

>     Thank you. I have one problem. Is this code OK?

You should use TDateTime::DecodeDate() and TDateTime::DecodeTime() instead
of TDateTime::FormatString().  Even better, the VCL already has a
DateTimeToSystemTime() function for converting TDateTime to SYSTEM_TIME.
Try this instead:

    bool __fastcall SetSystemNTPTime()
    {
        SYSTEMTIME st = {0};
        DateTimeToSystemTime(GetNTPDateTime(), st);
        return SetSystemTime(&st);
    }


Gambit


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/03
Technical Details
Message-ID: <3f53a6c6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f530b12$1@newsgroups.borland.com> <3f53139b@newsgroups.borland.com> <3f531c07@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,c8dcc4ffbd3f4cee
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-01 13:09:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f530b12$1@newsgroups.borland.com> <3f53139b@newsgroups.borland.com> <3f531c07@newsgroups.borland.com>
Subject: Re: Set System Date/Time
Date: Mon, 1 Sep 2003 13:06:45 -0700
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f53a6c6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1062446790 207.175.226.26 (1 Sep 2003 13:06:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail