Seconds and Milliseconds

Hello all,
I am creating a timer program that, right now, seems to work ok, except
for a few small bugs. First off, I need to know if there is any way to
make a thread sleep for 1000 milliseconds (I can do this) but also have
another thread that will let me do the milliseconds. Does anyone know
how to do this? Also, how do I stop the execution of a thread? I want the
program to stop when the user closes the application, but I cannot seem
to get it to stop. I have tried myThread.destroy() and myThread.yield()
but neither seems to stop the thread and therefore the program. Any help
at all would be enormously appreciated. Thanks in advance.

The right way to stop a thread is to call Thread.interrupt() on it. If the thread you want to stop is blocking in a wait() or similar method (see the API docs of Thread.interrupt()) it will get an InterruptedException.
Note that there is also a method stop() in class Thread, but it is deprecated (lookup the API documentation to read why you shouldn't use that method).
Jesper

Similar Messages

  • How to include seconds and millisecon​d in the CSV file time stamp generated by the SpreadShee​t Object?

    I'm Using Lookout 6.02, in a XP Pro Windows Machine, Service Pack 3.
    I have an application that collects data at the rate of 20 samples per second. It works just fine, the CSV File contains all the samples without missing a single one.
    The problem is that the time stamp in the data file only shows hours and minutes. With 20 sample per second, there are 1200 samples per minute. It is hard to figure out in which second or sample number, occurred some events collected. These files are open with Excel and analyzed with Excel. There is no easy way to implement a search or a guidance for knowing the sample number or the exact time in Excel.  My problem is to add the seconds and if possible the milliseconds to the time stamp done by the spreadsheet object.
    Any suggestion?
    Other ways to do the same that includes the time stamp all the way down to milliseconds?

    Create another column with the Now() function, then set the calumn format to hh:mm:ss.s
    expression would be now(trigger) for the date and time or now(trigger)-today(trigger) for just time
    The trigger will cause the expression to stay updated, perhaps using the same trigger for logging the spreadsheet.
    Good luck
    Mike
    Message Edited by Mike@DTSI on 01-16-2009 04:12 PM
    Mike Crabtree - Lead Developer
    Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
    (866) 964-6948 / (760) 247-9512

  • How can I make my Introduction_mc automatically disappear after 10 Seconds and load Home_mc?

    Hi,
    How can I make my Introduction_mc automatically disappear after 10 Seconds and load Home_mc (automatically)? I don't want user to change by himself this Introduction page. It should be done automatically.
    What is the procedure and code to achieve it, please?
    Thanks.

    Hi,
    I gues you are using AS2.0, then use setInterval, in AS3.0 user Timer Class.
    AS2.0
    var interval:Number = setInterval(doThis,10000);//in milliseconds
    function doThis():Void{
    //do something;
    AS3.0
    var timer:Timer = new Timer(10000, 1);
    timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerCompleteHandler, false, 0, true )
    function onTimerCompleteHandler(event:TimerEvent):void{
    //do something;
    For details: http://blogs.adobe.com/pdehaan/2006/07/using_the_timer_class_in_actio.html
    Warm Regards
    Deepanjan Das
    http://deepanjandas.wordpress.com

  • I own a MacBook Pro 2.4 ghz non unibody. I turn on my laptop for ten seconds and it freezes. It boots perfectly and runs for ten seconds until everything freezes. Please help!

    I own a MacBook Pro 2.4 ghz non unibody. I turn on my laptop for ten seconds and it freezes. It boots perfectly and runs for ten seconds until everything freezes. Please help!

    See if you can boot into single user mode with Command S.

  • Help I just installed the latest update on my IPhone4 and now I can't open any of my stored podcasts. When I hit the podcast icon, the screen goes white for a second and the goes back to the opening page with all the icons. What happened?

    Help! I just installed the latest update on my IPhone 4 and now I can't access my podcasts. When I hit the podcast I on, the screen goes blank for a second and then opens to the home screen with all my icons. What happened?

    Try a reset which is similar to a computer restart and is done by pressing and holding the home button and the sleep/wake or on/off button simultaneously you see the Apple logo and then release.

  • I opened my iPod Touch up to fix my home button. When i closed it back up it had a white screen. I tried pressing lock and home button for 10 seconds and it worked but while i'm using it it goes white with lines on the screen. Help please

    I opened my iPod Touch up to fix my home button. When i closed it back up it had a white screen. I tried pressing lock and home button for 10 seconds and it worked but while i'm using it it goes white with lines on the screen. Help please. This has been happening for a while and i've tried everything but it doesn't work.

    Try:
    fix for Home button
    iPhone Home Button Not Working or Unresponsive? Try This Fix
    - If you have iOS 5 and later you can turn on Assistive Touch it add the Home and other buttons to the iPods screen. Settings>General>Accessibility>Assistive Touch
    - If not under warranty Apple will exchange your iPod for a refurbished one for:
    Apple - Support - iPod - Repair pricing
    You can do it an an Apple store by:
    Apple Retail Store - Genius Bar
    or sent it in to Apple. See:
    Apple - Support - iPod - Service FAQ
    - There are third-party places like the following that will repair the Home button. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens

  • When my phone turns on it goes to the normal screen for 1 second and then it gets very large so you can only see a few icons

    When I turn my iphone on, the usual main icon screen shows for about a second and then it blows up so you can only see a few icons at a time.  How do you turn this off?

    Your phone might be on Zoom somehow, try just the simple "gestures" fix
    Double tap with 3 fingers on the screen, then drag down. That should at least zoom out. If that does not work, try scrolling through the screen, but using 3 fingers instead of 1.
    From there you should be able to access Settings>General>Accessibility>Zoom>OFF
    Hope this helps

  • When I turn on or restart my Macbook Pro Retina 15", my entire screen flashes completely bright yellow for a few seconds and then it goes to the normal Welcome screen.  How do I fix this??

    Hi Everyone,
    This problem just started today.  When I turn on or restart my Macbook Pro Retina 15" (Mid 2012 version), my screen is light gray like normal, and then after a few seconds my entire screen flashes completely bright yellow for a few seconds, and then it goes to the normal Welcome screen (where I choose to login as myself or a guest user).  This suddenly started today and has not stopped since.  This keeps happening every single time I turn on or restart my computer.
    Yesterday I installed all the Mavericks and other updates that were available in the App Store, so I'm wondering if this is related to that since this never happened prior to my doing those updates yesterday.  When I first installed the new OS X Mavericks (10.9.3) update, it went through the whole installation process (took about 10 minutes), and then during the installation I got an error message saying that it couldn't verify my iTunes application that was on my laptop, and then my laptop finished installing the updates.  Then once my laptop restarted, the App Store "Updates" section said that I had to do the whole OS X Mavericks (10.9.3) and iTunes (Version 11.2) updates all over again.  So my laptop did the whole installation again (took about 10 minutes, but this time I didn't get that "iTunes error message" during the installation process). 
    Now, when I go to the App Store "Updates" section, it says the following under "Updates Installed in the Last 30 days":
    -Digital Camera RAW Compatibility Update (Version 5.05) installed May 15, 2014
    -OS X Update (Version 10.9.3) installed May 15, 2014
    -iTunes (Version 11.2) installed May 15, 2014
    -OS X Update (Version 10.9.3) installed May 15, 2014
    -iTunes (Version 11.2) installed May 15, 2014
    -Security Update 2014-002 (Version 1.0) installed April 22, 2014
    I'm wondering if this flashing bright yellow screen upon bootup is related to the fact that my laptop installed the OS X Update and the iTunes Update two times each?  Or is this new problem totally unrelated?  It's just that this problem started a day after these 2 updates were installed twice.
    My Macbook Pro Retina 15" (Mid 2012 version) is otherwise working fine at least as of now.  The only issue so far is this flashing bright yellow screen every time I turn on or restart my computer.
    If anyone could please help me fix this so that my bootup screen doesn't flash completely bright yellow anymore, I would be forever grateful! 
    Thank you so much for reading this and for any help you can provide. 
    hope everyone is well,
    Elaine

    Hey everyone in Apple world!
    I figured out how to fix the flashing yellow screen problem that I've been having on my MBP!  Yessssss!!!
    I found this super handy website with the golden answer: http://support.apple.com/kb/HT1379
    I followed the instructions on this page and here's what I did:
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    I went through the 6 steps above twice, just to make sure I got rid of whatever stuff was holding up my bootup process.  Since I did that, my MBP boots up just like normal.  No flashing yellow screen anymore!!   
    (Note that I arrived at this solution when I first saw this page: http://support.apple.com/kb/TS2570?viewlocale=en_US)
    Let me know if this works for you!
    Elaine

  • When I open Iphoto, I see all my photos for a second and then they disappear and only a white dotted box appears.  Then I click on it and for photos is a triangle with an exclamation point.  It doesn't happen to all but quite a lot. how to I get them back

    When I open Iphoto, I see all my photos for a second and then they disappear and only a white dotted box appears.  Then I click on it and for photos is a triangle with an exclamation point.  It doesn't happen to all but quite a lot. how to I get them back

    Have you recently deleted photos using the finder or run clean up software?  Is so restore your backup
    If not the backup your iPhoto Library and launch iPhoto while depressing the option and command keys. Rebuild your database
    LN

  • My ipod needs to be restored but it only stays on the "connect to itunes" for approximately 20 seconds and then turns black as if it is turned off.

    So a couple of months ago, I had to restore my new IPOD 5 TOUCH because i had forgotten the password and disabled it, so as you can imagine I am quite familiar with restoring it.
    (The last time I had synced it was the only time that I had to restore it when I first got it when I had disabled it)
    This morning I wanted to sync my ipod. So I plugged my ipod into my WINDOWS computer and waited for itunes to open, and it did just like it is supposed to. It then said itunes needed the latest update so i continued with updating it. Itunes updated, but then said that my ipod needed the latest software. I said "ok update" and thats when itunes made my ipod into DFU mode without me even touching it.
    SOOOO as you can imagine I was quite upset. I then have realized that because Itunes had moved it into DFU mode on its own, I could not manually get my ipod out of DFU mode so the only thing i was left to do was go ahead and restore it.  (correct me if Im wrong)
    My huge issue right now is that my ipod NEEDS to be restored, but it only stays on the "connect to itunes" screen for approximatley 20 seconds and then turns black as if it has been turned off. When I plug it into my computer and turn it on to the "connect to itunes" mode, it does open it in itunes and starts "extracting sofftware" but then when it turns black after 20 seconds, it closes out because my computer thinks it has turned off.
    I have tried charging it, and nothing has progressed. Im not sure if anything can be done for it right now, or if I could bring it to an apple store to fix it... it's brand new about 3 months old.
    HELP and some advice would be greatly appreciated  !
    Thanks!
    -B

    Try:                           
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable
    - Try on another computer                            
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar                                     

  • The calendar icon on my iphone 6 shows that I have 2 items in my inbox but when I click on it it does not open the inbox but goes black for a second and then returns to iphone

    The calendar icon on my iphone 6 shows that I have 2 items in my inbox but when I click on it it takes me to the full year calendar, at bottom of screen it says Inbox (2) - when i click on that the screen goes black for a second and then defaults back to the home screen. Have tried everything, rebooting, reinstalling, refreshing - very frustrating - can someone help?
    Thanks

    Try This...
    Close All Open Apps... Sign Out of your Account...  Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • Email not opening This is a sudden thing, Email had been working fine for two months then today would not stay open now it will not open at all. after trying to open mail I receive a white screen for a nano second and the app closes

    Email not opening on my iPad2 This is a sudden thing, email had been working fine since purchasing the device then today would not stay open,  now it will not open at all. After trying to open mail I receive a white screen for a nano second and the app closes.

    Have you tried closing the Mail app completely ? From the home screen (i.e. not with Mail 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Dock disappears for a few seconds and minimized apps open up

    Hello
    My dock at the bottom of the display will disappear for a few seconds and at the same time, my minimized open applications will open up. This usually happens when I'm running a few light applications at once. It almost seems to "gulp" or catch it's breath.
    I'm not sure if this is related but for the second time since purchasing the machine the dock is showing a sort of double reflection at the very bottom. An open application has what looks like two lit triangles underneath the icon instead of the usual one triangle. The same area at the bottom of the dock shows a very tiny "bottom" of the page I have open, in this case Safari. It also moves left and right as I move the open page left and right. If I move the page down, the sliver at the bottom of the dock moves up.
    This is only the second time this has happened. The first time it went away on it's own and today it's back. It's not troublesome at all but I'm just wondering what may be causing these symptoms.
    Thanks!

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • When I try to open the "markets" page on the Firefox hompage, it displays for 3 or 4 seconds and then drops off; I get a white screen; this does not happen with Explorer.

    When I open "markets" from the homepage, it comes up but drops off after a few seconds and
    I get a white page. This does not happen with Explorer. A similar but much more extensive
    problem happened a month or so ago (I couldn't open attachments). I called Microsoft and the
    fellow messed about with my computer for an hour or so, but ended up saying he couldn't help
    me. However, when he went away, the problems went away.
    == This happened ==
    Every time Firefox opened
    == two weeks ago?

    ~~red:<u>'''''displays for 3 or 4 seconds and then drops off'''''</u>~~
    If you have RealPlayer Browser Record Plugin <u>'''extension'''</u>, disable/remove the RealPlayer Browser Record Plugin extension in the RealPlayer Preferences (RP: Tools > Preferences > Download & Recording) . Restart Firefox and test.
    <u>See Noah_SUMO's illustrated answer in this thread if the above is not clear:</u> https://support.mozilla.com/en-US/forum/1/557689?
    The RealPlayer Browser Record Plugin <u>'''extension'''</u> adds some extra features like saving media files.
    Be sure not to get confused with the RealPlayer <u>'''plugin'''</u> (Tools > Add-ons > Plugins) that plays media files.
    https://support.mozilla.com/en-US/forum/1/557689?
    http://support.mozilla.com/en-US/forum/1/459823
    https://support.mozilla.com/en-US/forum/1/446905?
    https://support.mozilla.com/tiki-view_forum_thread.php?forumId=1&comments_parentId=472596
    http://support.mozilla.com/en-US/forum/1/461211
    http://support.mozilla.com/en-US/forum/1/376867
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]].
    ~~red:<u>'''''Other Issues'''''~~: to correct security/stability issues</u>
    <u>'''Update Java'''</u>: your ver. 1.6.0.17; current ver. 1.6.0.20 (<u>important security update 04-15-2010</u>)
    ''(Windows users: Do the manual update; very easy.)''
    See: '''[http://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox#Updates Updating Java]'''
    Do the update with Firefox closed.
    <u>'''Update Shockwave for Director'''</u>: your version 11.0; current version 11.5
    NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    SAVE the installer to your hard drive (Desktop is a good place so you can find it). When the download is complete, exit Firefox (File > Exit), locate and double-click in the installer you just downloaded, let the install complete.
    IMPORTANT: I have found it wise to always restart your system after doing anything with Adobe products.
    See: '''[http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox#_Installing_Shockwave Installing Shockwave]'''

  • When i open iphoto i see my photo's for 1 second and then they are gone .The photo's are still there but i can see them only on the bottom or top of my screen when i try to open them i get a sign that it is not possible.Can somebody please  help me?

    when i open iphoto i see my photo's for 1 second and then they are gone .The photo's are still there but i can see them only on the bottom or top of my screen when i try to open them i get a sign that it is not possible.Can somebody please  help me?

    Have you upgraded to iPhoto 9.6 for compatibility with Yosemite? If not, try that first.
    It looks like iPhoto has lost the connection between the thumbnails and the original image files.
    This can be caused by a corrupted iPhoto library, or the originals have been deleted or moved.
    Try first to rebuild your iPhoto Library:
    If you do not have a current backup of the iPhoto library, make a copy of the library, but do not overwrite any previous backup.
    Launch iPhoto with the ⌥⌘-key combination (option-command) held down.
    Select "rebuild" from the first aid panel.  This may take a while for a large library.
    Can you now see your photos again?
    If not, rebuild the library with iPhoto Library manager as described by Old Toad:            Re: iphoto crashed

Maybe you are looking for

  • Automatic creation of Follow-up document

    Hi, I have a requirement to create a sales order automatically from a quotation once the status of the quotation is changed to 'released'. Can I use any standard SAP defined actions to achieve this functionality? If there is no standard actions defin

  • How to create object through  transaction snro

    Hi ,    I want to create an object through Snro transaction. I dont know how to use this transaction. Please Help. Thanks in advance. Nikita

  • Trouble with Export Layers to Files

    I'm trying to export all layers and want to keep the original name.  I left the field: "File Name Prefix" blank so it would keep the name, but after exporting it adds: '_0001_' , '_0002_' etc in front of the name, and adds an extra .jpg so files name

  • TS1292 The seriel or card pin is not recognized.  I also have a seriel beginning wit 63

    I have entered the PIN and it was not recognized.  Seriel number is coming back as invalid.  The card was given to me for purchasing an iPod nano on black Friday.  I was able to scan the barcodes with a bar code scanner. <Personal Information Edited

  • MM-TCODE ME56 Enchancement req?

    Hi I need to change the O/P format for tcode ME56 form 3-liner to 1-liner along with the addition of some fileds for Vendor details. Can any one tell me the way,how to do it?will it be done only by Badi/Exits. I don;t have knowledge of them?can any o