Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

This definitely fixes the bug I tried to fix in commit 26f3fe2

Needed to set timeInfo.tm_dst = -1 to tell mktime to figure out if DST is in affect for the local timezone.
  • Loading branch information...
commit f4b34586206d18863f88ab2cec8a7ff5f37cfa22 1 parent 7459410
Dan VerWeire authored April 15, 2011

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  src/Database.cpp
10  src/Database.cpp
@@ -218,7 +218,7 @@ Handle<Value> Database::Close(const Arguments& args) {
218 218
 int Database::EIO_AfterQuery(eio_req *req) {
219 219
   //printf("Database::EIO_AfterQuery\n");
220 220
   ev_unref(EV_DEFAULT_UC);
221  
-  
  221
+
222 222
   struct query_request *prep_req = (struct query_request *)(req->data);
223 223
   
224 224
   HandleScope scope;
@@ -390,15 +390,13 @@ int Database::EIO_AfterQuery(eio_req *req) {
390 390
                   break;
391 391
                 case SQL_DATETIME :
392 392
                 case SQL_TIMESTAMP :
393  
-                  //reset the value of our time struct to all zeros
394  
-                  memset(&timeInfo, 0, sizeof(struct tm));
395  
-                  
396 393
                   //I am not sure if this is locale-safe or cross database safe, but it works for me on MSSQL
397 394
                   strptime(buf, "%Y-%m-%d %H:%M:%S", &timeInfo);
  395
+                  timeInfo.tm_isdst = -1; //a negative value means that mktime() should (use timezone information and system 
  396
+                        //databases to) attempt to determine whether DST is in effect at the specified time.
  397
+                  
398 398
                   tuple->Set(String::New((const char *)columns[i].name), Date::New(mktime(&timeInfo) * 1000));
399 399
                   
400  
-                  //strftime(buf, MAX_VALUE_SIZE, "%D %H:%M:%S", &timeInfo);
401  
-                  //tuple->Set(String::New((const char *)columns[i].name), String::New(buf));
402 400
                   break;
403 401
                 case SQL_BIT :
404 402
                   //again, i'm not sure if this is cross database safe, but it works for MSSQL

0 notes on commit f4b3458

Please sign in to comment.
Something went wrong with that request. Please try again.