Most viewed recipes tagged "uuid" but not "archive"http://code.activestate.com/recipes/tags/-archive+uuid/views/2016-07-07T17:52:15-07:00ActiveState Code RecipesIP and MAC addresses (Python)
2016-07-07T17:52:15-07:00Jean Brouwershttp://code.activestate.com/recipes/users/2984142/http://code.activestate.com/recipes/577191-ip-and-mac-addresses/
<p style="color: grey">
Python
recipe 577191
by <a href="/recipes/users/2984142/">Jean Brouwers</a>
(<a href="/recipes/tags/ios/">ios</a>, <a href="/recipes/tags/ip/">ip</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/mac/">mac</a>, <a href="/recipes/tags/macos/">macos</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/python2_4/">python2_4</a>, <a href="/recipes/tags/python3_5/">python3_5</a>, <a href="/recipes/tags/uuid/">uuid</a>, <a href="/recipes/tags/windows/">windows</a>).
Revision 3.
</p>
<p>This module collects all IP and MAC addresses from several available sources on the underlying system. See the module documentation for more details, supported Python releases and platforms.</p>
Get a posix timestamp from a type 1 uuid (Python)
2008-08-13T18:56:29-07:00Kent Tenneyhttp://code.activestate.com/recipes/users/4166394/http://code.activestate.com/recipes/576420-get-a-posix-timestamp-from-a-type-1-uuid/
<p style="color: grey">
Python
recipe 576420
by <a href="/recipes/users/4166394/">Kent Tenney</a>
(<a href="/recipes/tags/datetime/">datetime</a>, <a href="/recipes/tags/time/">time</a>, <a href="/recipes/tags/timestamp/">timestamp</a>, <a href="/recipes/tags/uuid/">uuid</a>).
</p>
<p>The uuid timestamp is 60 bits, the number of 100 nanosecond increments since Oct. 15, 1582
This simple function returns a value which makes datetime.datetime.fromtimestamp() happy.</p>
<p>It simply rewinds the code in the standard library's uuid1 function:</p>
<pre class="prettyprint"><code>nanoseconds = int(time() * 1e9)
# 0x01b21dd213814000 is the number of 100-ns intervals between the
# UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
timestamp = int(nanoseconds/100) + 0x01b21dd213814000
</code></pre>