title: SQL Server getdate() switching to/from DST more than a minute later than expected
body: <p>Running SQL Server 2008 R2 on Windows Server 2008 R2.</p>
  
  <p>We've recently discovered that the SQL Server getdate() function does not appear to switch to/from daylight saving time right at 2:00am local time as I would expect it to.  The server's timezone is set to "(UTC-06:00) Central Time (US &amp; Canada)" with the "Automatically adjust clock for Daylight Saving Time" box checked.</p>
  
  <p>As an example, we have a table with several columns, one of which has type datetime and a default constraint of getdate().  We have a process that inserts records into that table, allowing SQL to supply the default value for that column.  Here was the result when we ran it early on the morning of March 12, 2017 (Central Time):</p>
  
  <ul>
  <li>2017-03-12 01:59:55.797</li>
  <li>2017-03-12 01:59:57.707</li>
  <li>2017-03-12 01:59:58.243</li>
  <li><strong>2017-03-12 02:00:01.570</strong></li>
  <li><strong>2017-03-12 02:00:01.640</strong></li>
  <li><strong>2017-03-12 02:00:02.990</strong></li>
  <li>... <strong>similar results between 02:00:03 and 02:01:16 omitted</strong></li>
  <li><strong>2017-03-12 02:01:16.317</strong></li>
  <li><strong>2017-03-12 02:01:17.393</strong></li>
  <li><strong>2017-03-12 02:01:20.577</strong></li>
  <li>2017-03-12 03:01:22.720</li>
  <li>2017-03-12 03:01:24.853</li>
  <li>2017-03-12 03:01:25.397</li>
  </ul>
  
  <p>The results above are sorted by an identity column, so I assume were inserted in the order listed.  Per the DST rules for US Central Time, the times in <strong>bold</strong> are invalid.  Finally, after about a minute and 21 seconds, the system figured out that it needed to switch to DST, so all subsequent records were correct.  A similar problem seems to exist when switching back to standard time in November -- getdate() continues to return times in DST for over a minute past the first occurrence of 2:00am, then jumps back one hour to standard time.</p>
  
  <p>Perhaps this is just the way that the underlying Windows API GetLocalTime function behaves?  In any event, my questions are these:</p>
  
  <ol>
  <li>Is this a known or expected behavior?</li>
  <li>If so, what is the reason / cause as well as the scope?</li>
  <li>Does the sysdatetimeoffset() function have similar behavior, i.e., would it have returned the same date and time parts as illustrated above, although hopefully with a self-consistent offset?</li>
  </ol>
  
  <p>FWIW, we are converting this and other similar datetime columns to type datetimeoffset and are planning to use the sysdatetimeoffset() SQL function to populate it.  We discovered this unexpected behavior while developing scripts to update the offsets on our existing data.</p>
  
  <p>Thanks in advance for any info related to this topic!</p>
  
  <p>@@version = Microsoft SQL Server 2008 R2 (SP3) - 10.50.6220.0 (X64) 
      Mar 19 2015 12:32:14 
      Copyright (c) Microsoft Corporation
      Enterprise Edition (64-bit) on Windows NT 6.1  (Build 7601: Service Pack 1)</p>