<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic USLEEP -vs- NANOSLEEP in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233436#M51992</link>
    <description>Hello group;&lt;BR /&gt;&lt;BR /&gt;I have an old laptop that wasn't doing anything, so I loaded Linux on it and wrote a program to send my e-mail in morse code (so I can "listen" to my e-mail while I do other things).&lt;BR /&gt;&lt;BR /&gt;I'm using "usleep" to time the length of the morse code bits. &lt;BR /&gt;&lt;BR /&gt;The problem is that usleep does not appear to  work uniformly i.e. I have a formula to change the speed of the morse code - but although the speed should change progressively, it does not.&lt;BR /&gt;&lt;BR /&gt;After reading the manpage I'm guessing that the system is truncating or rounding-off the time (note that the CPU/IO/memory usage is close to nil).&lt;BR /&gt;&lt;BR /&gt;Do [you] think if I rewrite the program to use "nanosleep" that I will see better performance?&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;tonyp&lt;BR /&gt;&lt;BR /&gt;(as usual, any reply I get that at least gives me something worth investigating will get 5 points. Replies that lead to the solution will get 10)</description>
    <pubDate>Mon, 05 Apr 2010 19:31:22 GMT</pubDate>
    <dc:creator>tony j. podrasky</dc:creator>
    <dc:date>2010-04-05T19:31:22Z</dc:date>
    <item>
      <title>USLEEP -vs- NANOSLEEP</title>
      <link>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233436#M51992</link>
      <description>Hello group;&lt;BR /&gt;&lt;BR /&gt;I have an old laptop that wasn't doing anything, so I loaded Linux on it and wrote a program to send my e-mail in morse code (so I can "listen" to my e-mail while I do other things).&lt;BR /&gt;&lt;BR /&gt;I'm using "usleep" to time the length of the morse code bits. &lt;BR /&gt;&lt;BR /&gt;The problem is that usleep does not appear to  work uniformly i.e. I have a formula to change the speed of the morse code - but although the speed should change progressively, it does not.&lt;BR /&gt;&lt;BR /&gt;After reading the manpage I'm guessing that the system is truncating or rounding-off the time (note that the CPU/IO/memory usage is close to nil).&lt;BR /&gt;&lt;BR /&gt;Do [you] think if I rewrite the program to use "nanosleep" that I will see better performance?&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;tonyp&lt;BR /&gt;&lt;BR /&gt;(as usual, any reply I get that at least gives me something worth investigating will get 5 points. Replies that lead to the solution will get 10)</description>
      <pubDate>Mon, 05 Apr 2010 19:31:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233436#M51992</guid>
      <dc:creator>tony j. podrasky</dc:creator>
      <dc:date>2010-04-05T19:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: USLEEP -vs- NANOSLEEP</title>
      <link>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233437#M51993</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this person seems to think that nanosleep gave him more accurate results.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://cc.byexamples.com/2007/05/25/nanosleep-is-better-than-sleep-and-usleep/" target="_blank"&gt;http://cc.byexamples.com/2007/05/25/nanosleep-is-better-than-sleep-and-usleep/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;Matt&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2010 06:01:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233437#M51993</guid>
      <dc:creator>Matt Palmer_2</dc:creator>
      <dc:date>2010-04-06T06:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: USLEEP -vs- NANOSLEEP</title>
      <link>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233438#M51994</link>
      <description>Matt: thanx for the URL. &lt;BR /&gt;&lt;BR /&gt;They have the answer there. Now all I need to do is figure out how to use their function in my program. :-)&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;tonyp</description>
      <pubDate>Wed, 07 Apr 2010 01:32:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/usleep-vs-nanosleep/m-p/5233438#M51994</guid>
      <dc:creator>tony j. podrasky</dc:creator>
      <dc:date>2010-04-07T01:32:21Z</dc:date>
    </item>
  </channel>
</rss>

