title: Create 64-bit value from datetime object
body: <p>I'm working with pulling information out of Active Directory which means I'm dealing with some COMObjects. One of them has a date that is stored as a 64-bit integer (which is actually two 32-bit ints). I've figured out how to change it into a datetime object by using the following code.</p>
  
  <pre><code>def convert_to_datetime(time_object):
      # http://docs.activestate.com/activepython/2.6/pywin32/html/com/help/active_directory.html
      d = 116444736000000000L #diference between 1601 and 1970
      time_int = (((long(time_object.highpart) &lt;&lt; 32) + long(time_object.lowpart)) - d)/10000000
      return datetime.datetime.fromtimestamp(time_int)
  </code></pre>
  
  <p>Now with this in place I'm wanting to build a unit test for this. However, I can't seem to figure out how to generate a 64-bit integer from a datetime object. What I am doing currently is I have created a class to replicate a COMObject, which stores its value as two 32-bit integers, and then hard-coded the values for the date and integer that match. However, I would like something that creates these values based on the time of "right now".</p>
  
  <p>Here is what the unit test looks like currently, which passes.</p>
  
  <pre><code>    def test_convert_to_datetime_for_64bit_int_returns_value(self):
          now_com_time = COMObjectDate(30375774,216380170)
          self.assertEqual(datetime.datetime(2014, 6, 3, 14, 0, 13), AD_AG.convert_to_datetime(now_com_time))
  
  class COMObjectDate:
      def __init__(self, high, low):
          self.highpart = high
          self.lowpart = low
  </code></pre>
  
  <p>Is there a way to generate the two 32-bit values from a datetime object?</p>
  
  <p><em>Side note:</em> I realize I may be over thinking this some since my unit test does pass but I would prefer to not have hard-coded values so that the tests are stronger and not reliant on values that "just work". </p>