Howto set system clock with milliseconds precision

Hi! I need to set the system clock with milliseconds precision. The Labwindows CVI SetSystemTime function use only seconds precision. How to get around the problem?
Thanks in advice!
Solved!
Go to Solution.

I talked too early,
Actually I found that the SDK version of the  SetSytemTime function does accept milliseconds.
However, its usage is a little different.
You need to create an object of type SYSTEMTIME and set its members to the values you need.
Then, call the SetSystemTime function (of the WinSDK) to set the clock.
You need to add "windows.h" to the top of your include list.
(see SDK help, there is a sample code available there) 
Message Edited by ebalci on 01-04-2010 12:05 PM
S. Eren BALCI
www.aselsan.com.tr

Similar Messages

  • Display Synchronised System Clock With Milliseconds (HH:MM:SS:mm)

    Hello All,
    I need to display the system clock with hours, minutes, seconds and milliseconds (the system clock it synchronised via NTP or GPS and needs to be accurate)
    Using the Buddy API time functions I can display the time with an accuracy of seconds but the inbuilt lingo "the Milliseconds" and Ticks does not correspond to the system time.
    for example I tried using
    member("MyTimeStamp").text = baSystemTime("%0H"&":"&"%0M"&":"&"%0S"&":"&chars(""&the milliseconds, 6,7))
    but the seconds change out of synch with the milliseconds, the milliseconds are approximately 10-12 ms faster and I don't want to fudge the timing, I recorded the display with a slow motions camera and can see the seconds reset to 0 when the milliseconds are already at a value of 10 - 12.
    Any Idea how I can derive milliseconds using the system time? HH:MM:SS:mm
    thanks.

    10-12 ms delay (error) is the correspondent of a 80-100 FPS (polling interval).
    Theoretically speaking, to get 1ms delay (error) you need to run your script at 999 FPS (the max value allowed by D12).
    Practically speaking, that's not possible (many other factors are involved here).
    cheers

  • How to Sync System Clock with Internet Time in Windows 7?

    "Internet Time" tab is missing in Clock Settings as shown in below link.
    http://mintywhite.com/windows-7/7maintenance/windows-seven-7-sync-system-clock-with-internet-time-how-to/
    Please suggest how to Sync System Clock with Internet Time in Windows 7?
    Regards, Dharmendra, Bangalore (India)

    The note at the bottom of the first link from Alex Verboon has the following, which worked on my Domain-associated Windows 7 system:
    Synchronizing with an Internet time server
    You can synchronize your computer clock with an Internet time server. This means that the clock on your computer is updated to match the clock on the time server, which can help ensure that the clock on your computer is accurate. Your clock is typically updated
    once a week and needs to be connected to the Internet for the synchronization to occur.
    Note
    If your computer is on a domain, you can't synchronize your clock with an Internet time server.
    Open Date and Time by clicking the Start button, clicking Control Panel, clicking Clock, Language, and Region, and then clicking Date and Time.
    Click the Internet Time tab, and then click Change settings. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
    Click Automatically synchronize with an Internet time server, select a time server, and then click OK.

  • Setting system clock

    It probably is a daft question - but please can anyone tell how to set
    system date using the java api. By setting system date I mean the
    computer's clock.
    Thank you.

    Java does not have a method for that. You need to access the os commands for that, either via JNI or the Runtime or ProcessBuilder classes. This will make the application non-portable.

  • Having problem setting system property with java -D name = value

    I want some clarification. Consider the statement below
    java -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    -Djava.rmi.server.hostname=xyz.com
    -Djava.security.policy=java.policy engine.ComputeEngine
    1. Is the syntax right for specifying a file directory as codebase?
    -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    2. What does this hostname property imply? Does this mean that the program which is started can be accesed by xyz.com?
    -Djava.rmi.server.hostname=xyz.com

    Kurt,
    I modified some of my directory structure as shown below and tried to execute. But I have got the same error again. Could you tell how to correct this error?
    Under c:\home\ann\public_html\classes directory, I have the Following:
    Sub-directory compute [Contains Compute.class and Task.class File]
    Sub-directory engine [Contains ComputeEngine_Skel.class and ComputeEngine_Stub.class Files]
    Sub-directory Meta-inf [Contains Manifest.mf file]
    File compute.jar
    Under c:\home\ann\src directory, I have the following:
    Sub-directory engine [Contains ComputeEngine.java, ComputeEngine.class]
    File java.policy
    Under c:\home\jones\public_html\classes directory, I have the Following:
    Sub-directory client [Contains Pi.class File]
    Current working directory is c:\home\ann\src
    The output from echo %CLASSPATH% was c:\home\ann\src; c:\home\ann\public_html\classes\compute.jar
    When executing the command:
    java -Djava.rmi.server.codebase=file:/c:\home\ann\public_html\classes
    -Djava.rmi.server.hostname=bwing2
    -Djava.security.policy=java.policy engine.ComputeEngine
    I am getting the error,
    ComputeEngine Exception: Stub class not found: engine.ComputeEngine_Stub; nested exception
    is : java.lang.ClassNotFoundException: engine.ComputeEngine_Stub
    java.rmi.StubNotFoundException: Stub class not found:
    Sridhar

  • Is Mail.app one of the "erratic" behavior apps with a reset system clock?

    I am hoping someone can help with a fine detail of mail.app (v2.1.3) behavior.
    I had an incident where an iMac sent out 200+ smtp hits a minute and was tossed of the network for presumed zombie spaming.
    I think I have actually tracked the problem to an unfortunate conjunction of circumstances that is actually innocent (if still annoying)
    Let me set up the story:
    1. This is a common use computer, so Mail is not configured (except that it is --I'll get to that in a moment) and
    2. Safari will invoke Mail when you click on an "email link"
    Mostly everyone just quits mail if they goof and click an email link.
    BUT some time ago at least one person invoked Mail and composed a message. This message, naturally, remained in the outbox ever since. That person learned that they can't send email that way, so ever since they just cmd-Q Mail.
    BUT Before this person learned, they walked through the mail-config and told mail to try hitting smtp.mac.com:"nonExistantUser".
    So that covers the lead-up. Two days ago, mail was invoked via a Safari link, BUT it wasn't quit, it was sent to the background.
    Where it undoubtedly tried to send the outbox repeatedly until it was kicked off the network.
    Here is what I don't understand:
    Under this scenario of a mis-configured .mac address, will mail repeatedly try and fail to smtp at the maximum possible rate?
    OR
    Is the one other factor I am about to describe responsible?
    The one other factor:
    The clock battery is dead and there was a power failure at 4am that day.
    The system clock reset to 1969.
    Of course, nobody reset it.
    Is mail.app one of the apps that the finder message warns "may behave erratically"?
    (a GROSS simplification) does it have a bit of code like:
    1 check time-of-last-send-mail-attempt
    check newest-item-in-outbox
    if newest-item more recent then last-send-attempt
    do send-mail and record time-of-last-send-mail-attempt
    and go to 1
    else wait X minutes and go to 1
    which, if the clock was mis-set to 1969 would always record a last-send-attempt prior to anything in the outbox and trigger a send loop.
    Does anyone know if either Mail is tenacious about sending to a bad .mac address, or gets ridiculous under this circumstance for bad-clock-set?
    Marc

    I am hoping someone can help with a fine detail of mail.app (v2.1.3) behavior.
    I had an incident where an iMac sent out 200+ smtp hits a minute and was tossed of the network for presumed zombie spaming.
    I think I have actually tracked the problem to an unfortunate conjunction of circumstances that is actually innocent (if still annoying)
    Let me set up the story:
    1. This is a common use computer, so Mail is not configured (except that it is --I'll get to that in a moment) and
    2. Safari will invoke Mail when you click on an "email link"
    Mostly everyone just quits mail if they goof and click an email link.
    BUT some time ago at least one person invoked Mail and composed a message. This message, naturally, remained in the outbox ever since. That person learned that they can't send email that way, so ever since they just cmd-Q Mail.
    BUT Before this person learned, they walked through the mail-config and told mail to try hitting smtp.mac.com:"nonExistantUser".
    So that covers the lead-up. Two days ago, mail was invoked via a Safari link, BUT it wasn't quit, it was sent to the background.
    Where it undoubtedly tried to send the outbox repeatedly until it was kicked off the network.
    Here is what I don't understand:
    Under this scenario of a mis-configured .mac address, will mail repeatedly try and fail to smtp at the maximum possible rate?
    OR
    Is the one other factor I am about to describe responsible?
    The one other factor:
    The clock battery is dead and there was a power failure at 4am that day.
    The system clock reset to 1969.
    Of course, nobody reset it.
    Is mail.app one of the apps that the finder message warns "may behave erratically"?
    (a GROSS simplification) does it have a bit of code like:
    1 check time-of-last-send-mail-attempt
    check newest-item-in-outbox
    if newest-item more recent then last-send-attempt
    do send-mail and record time-of-last-send-mail-attempt
    and go to 1
    else wait X minutes and go to 1
    which, if the clock was mis-set to 1969 would always record a last-send-attempt prior to anything in the outbox and trigger a send loop.
    Does anyone know if either Mail is tenacious about sending to a bad .mac address, or gets ridiculous under this circumstance for bad-clock-set?
    Marc

  • Finder has got out of sync with system clock?

    For some reason, the system clock is reading the correct time, but the times indicated in Finder for "Date Modified" for every file or app are all wrong.
    For example, at 11:45PM (as indicated by the clock in the menu bar) I installed OnyX for the first time, but when I look at the newly-installed app itself in the Applications folder in Finder, in the Date Modified column it says "Today 11:23PM". Also, various different apps and files have identical Date Modified times - several have 12:12PM, several have 8:08AM, and many have 4:16PM.
    Two more confirmers that there's a problem - I just created a new folder at 12:35AM, and immediately went to look at it in the Finder - its Date Modified is "Today 12:00AM". And when I start up Plex, its own on-screen clock says "12:00AM" when the clock in the menu bar says 12:40AM.
    I've zapped the PRAM and forced a Spotlight reindex, but they've made no difference. Any suggestions?

    Is the correct Time Zone set for your region of use?
    Is the Time set to be coordinated with a network time server?
    These are two basic things that could go wrong. There may
    be others. I'm not sure at this moment what they may be.
    You may have to see if your use of OnyX has somehow
    changed the basic system settings; or maybe you did
    not use the section most likely in OnyX to be helpful.
    Or something else is acting up.
    (Looking into my Date Time panel now has me wondering,
    since I never look into there. It just works, usually!)
    Good luck & happy computing!

  • Have a compaq nc6320 laptop the system clock is set to 6/3/9999

    why can't I seem to change the clock on this laptop couldnt find in bois where to set bois clock and tgried to change in windows 7 and it will not change

    I am not a Mac user, but have multiple versions and profiles of Firefox. I note you ask about Macs, but have system details showing as Windows 7.
    I can only speak from a PC perspective, but no doubt you can sort it out yourself. It is down to the OS which browser is the default, although firefox has the option to check and reset that at startup.
    No doubt if I delved into the registry I could find how it sets the default browser, but in practical terms what I do is allow the OS to set itself up.
    # Choose any other alternative browser such as IE, make that the default, and allow that to take effect.
    #Then deselect IE as default browser checking.
    #Now start up the chosen version of Firefox, use Firefox's options to set that as default browser. (Options -> advanced -> general system defaults )
    It works, although some applications may choose IE regardless.
    *You may be interested in http://kb.mozillazine.org/Default_browser
    With luck something similar may work on a Mac

  • Windriver erro "System clock has been set back"

    I am having a problem opening the First Windriver program this year.
    I always get the error:
    System clock has been set back
    Feature WR_workbench
    License Path c\windriver\license\zwrsLicense.lic;\\license\WRSLicense.lic 
    FLEXIm error: -88,-309
    For further information, refer to the FLEXIm End User Manual,
    available at www.macrovision.com.
    I also get a Different Workspace Version dialog box asking me to change or update the work space.
    I am using the Windows XP version on a Dell laptop computer that I have used for the last three years with the Windriver program that I updated each year. I have tried completely removing Windriver and National Instruments programs several times and rebooting all 2012 programs with no change in Windriver error.

    Hi eoconno1,
    If the Windriver program is related to the FIRST Robotics Competition then you will be able to get more help by posting in the FIRST community page at ni.com/first and searching/ asking in the NI FRC Community forum.
    This community forum is moderated by Applications Engineers specializing in support for FRC and FTC - they should be able to help you
    Milan

  • Error 15 with CLFN in nisyscfg.lvlib:Set System Image

    Recently upgraded to LV 2012 and code that worked for imaging cRIOs in LV 2011 had to be replaced with the new and improved nisyscfg.lvlib VIs: Set System Image, Get System Image, etc,...
    I'm receiving the following error message when my installed executable attempts to image a cRIO: 'Error 15 occurred at Call Library Function Node in nisyscfg.lvlib: Set System Image (Folder).vi:1->nisyscfg.lvlib: Set System Image (File).vi:1->GetSetSystemImage.vi'. The possible reason(s) displays: 'LabVIEW: Resource not found.'
    What installation packages/products are required for the system configuration VIs? I'm including NISysCfg_Runtime and NISysAPI_Framework.
    Thanks for your time.  
    Solved!
    Go to Solution.

    I think I've solved part of the problem. Now I'm getting 'Error -2147220364 occurred at nisyscfg.lvlib: Set System Image (Folder).vi:1' with possible reason(s): 'NI System Configuration: (Hex 0x80040474) Command is not supported by given protocol.'

  • Setting the system time with only Java.

    Am trying trying to write a 100% pure java Alarm Clark. One feature I wish to have is to syncronize with the atomic clock.
    Is this possible in Java. All I have been able to find is system dependent ways to do it through exec.
    Thank you,
    Jacob

    What do you mean "atomic clock"? Do you wish to synchronize your alarm clock with GMT? If so, you can directly access the National Institute of Standards and Technology's atomic clock on-line...see the site :
    http://www.boulder.nist.gov/timefreq/service/its.htm
    You could then get the local time from the computer, thus appropriately adjusting your clock. Synchronizing your system clock to the atomic clock is system-dependent, as mentioned by the other respondent.

  • Timer with slow system clock

    I have a timer that performs scheduled events at a fixed rate. If the system clock is slow, is it possible that the associated TimerTask will stop running? Is there anything else that may be unexpectedly halting the execution of the TimerTask? Thanks.

    I have a server clock that I'd like to emulate on the client, by only obtaining the server time a few times per hour after initialization and relying on a client TimerTask to keep pace. Sometimes, a client's clock is slow due to a bad battery, etc. Occasionally, a client reports that their clock has either frozen or fallen off the pace by several seconds, even with a sound system clock. The code looks as follows:
    private final TimerTask heartbeatTask = new TimerTask() {
            public void run() {
                synchronized (heartbeatListeners) {
                    for (Iterator it = heartbeatListeners.iterator(); it.hasNext();) {
                        HeartbeatListener listener = (HeartbeatListener) it.next();
                        try {
                            listener.tick();
                        } catch(Exception e) {
                            e.printStackTrace();
                synchronized (serverTimeLock) {
                    serverTime += 1000;
    public init(...) {
         heartbeatTimer.scheduleAtFixedRate(heartbeatTask, 0, 1000);
    }

  • Is it acceptable for a developer to tell a user to tamper with the system clock?

    Im not sure where to post this question but i cant find a a way to email Apple with this question. I need an official response from Apple on whether or not it is acceptable for a developer to tell a user to tamper and change the system clock in order to use their app.

    I am actually the user. A game developer told me to do this in order to play their game temporarily because their update had a glitch. Their official response to their game forums was change date and play through the weekend until they could apply a patch.  Well, in turn it messed up my daughters game because her game is a progression style game which looks at the clock. I need something somewhere that says, tampering with the clock is not approved. Only way to bring my daughters game back to current progression is to buy "diamonds" because it is a "freemium" type game. Developer that told me to change clock basically told me "tough luck, go away" andi want to take them to court for about 800$ to buy appropriate amount of diamonds.

  • How to set the system clock in win2000? in linux? (RH)

    hi There,
    I need to set the system time on a pure java application.
    what is the proper way to do so? (I can't find any system property which corresponds to the system clock).
    if it's platform dependent , then I need to do so on win2000 and on linux RH.
    thanks

    I don't know about Windows but on RedHat, I would use the date command. Check the man pages for date and look at the -s or --set options.  Do a Runtime.exec to execute that.
    Of course, doing the in Java is not the best option. If you are trying to synchronized clocks on Windows and Linux systems, I would use some freely available Network Time Protocol programs. RedHat has a free NTP daemon available as an RPM in the standard distribution. For Windows, theres a free program called "Net Time" that runs as a service. Both can act as clients and servers.

  • History wont update unless i set my system clock ahead 3 hours

    I have uninstalled and reinstalled firefox but nothing i do works. The history will only start working if i set my clock ahead 3 hours. Any way to fix that besides setting myself to a different time zone that's 3 hours behind me.

    Hi brotheryang17,
    I asked qa and there are some more steps to take to make sure that it is not an add on affecting the functionality of bookmarks. The two suspicious one are Ad Block or Ghostery, however it could be a combination as well.
    To run an experiment we can try two things: disabling each of the add ons one at a time to make sure that it is not an add on, or can try to create a new profile temporarily and add a bookmark with the time normally set.
    [[Troubleshoot Firefox issues using Safe Mode]] and [[Use the Profile Manager to create and remove Firefox profiles]]

Maybe you are looking for

  • Ipod Touch won't sync

    I receive the following error messages when I try to sync my Ipod touch: "The IPOD cannot be synced. The disk could not be read from or written to." Sometimes I get this message when attempting to sync " Attempting to copy to the disk failed, the dis

  • Problems installing the latest version of itunes, I've tried everything!

    hello, I logged into my itunes a few days ago and clicked yes to upgrade to the latest verion. Ever since then, itunes will not open, I get a message saying 'itunes has encountered a problem and needs to close' I have searched through the support sit

  • Crop/Trim Marks Wrong Position: Quark 6, PS File, Distiller 8 (Poster Sizes)

    I am having a similar problem as a Quark 7 user making PDFs of posters: http://www.adobeforums.com/webx?128@@.3c05836f Acrobat Distiller 8 is moving my document's bottom trim marks into the wrong position. They appear too high on the PDF instead of a

  • Update Bool_data during validation exit

    Hello Experts, Is it possible to update the Bool_data fields during validation Exit ? I tried Update and Modify but not working. Example, Lv_text = 'TEST01'. Bool_data-bseg-sgtxt = Lv_text. so after posting, we will find the FI document line item tex

  • User Exit / BADI for CJ30

    Hi gurus, I have to block tranfer values for project`s on CJ30. I`m looking for a User Exit or BADI to CJ30 txc. I tried to use the prefix CNEX* User Exit`s but is not triggering. Thanks in advance. Andrew