title: Full-featured date and time library
body: <p>I'm wondering if anyone knows of a good date and time library that has correctly-implemented features like the following:</p>
  
  <ul>
  <li><strong>Microsecond resolution</strong></li>
  <li><strong>Daylight savings</strong> 
  
  <ul>
  <li><em>Example:</em> it knows that 2:30am did not exist in the US on 8 March 2009 for timezones that respect daylight savings.</li>
  <li>I should be able to specify a timezone like "US/Eastern" and it should be smart enough to know whether a given timestamp should correspond to EST or EDT.</li>
  </ul></li>
  <li><strong>Custom date ranges</strong>
  
  <ul>
  <li>The ability to create specialized business calendars that skip over weekends and holidays.</li>
  </ul></li>
  <li><strong>Custom time ranges</strong>
  
  <ul>
  <li>The ability to define business hours so that times requested outside the business hours can be rounded up or down to the next or previous valid hour.</li>
  </ul></li>
  <li><strong>Arithmetic</strong>
  
  <ul>
  <li>Be able to add and subtract integer amounts of all units (years, months, weeks, days, hours, minutes, ...).  Note that adding something like 0.5 days isn't well-defined because it could mean 12 hours or it could mean half the duration of a day (which isn't 24 hours on daylight savings changes).  </li>
  </ul></li>
  <li><strong>Natural boundary alignment</strong>
  
  <ul>
  <li>Given a timestamp, I'd like be able to do things like round down to the nearest decade, year, month, week, ..., quarter hour, hour, etc.  </li>
  </ul></li>
  </ul>
  
  <p>I'm currently using Python, though I'm happy to have a solution in another language like perl, C, or C++.</p>
  
  <p>I've found that the built-in Python libraries lack sophistication with their daylight savings logic and there isn't an obvious way (to me) to set up things like custom time ranges.</p>