/ Check-in [97e86ec6]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an error made in the previous commit. The parameters to localtime_s() were accidentally reversed. Ticket [bd484a090c807].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 97e86ec6df4d893527fe9f43eb46163d9b06416a
User & Date: dan 2011-06-21 12:53:14
Original Comment: Fix an error made in the previous commit. The parameters to localtime_s() were accidentally reversed.
Context
2011-06-21
13:46
Change the error message returned when localtime_r() fails to "local time unavailable". Ticket [bd484a090c8077] check-in: 0e82175f user: dan tags: trunk
12:53
Fix an error made in the previous commit. The parameters to localtime_s() were accidentally reversed. Ticket [bd484a090c807]. check-in: 97e86ec6 user: dan tags: trunk
12:47
Return an error if localtime_r() fails within one of the date/time functions. Fix for [bd484a090c]. check-in: 76ae8257 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/date.c.

425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507

#ifdef HAVE_LOCALTIME_R
static struct tm * osLocaltime_r(time_t *t, struct tm *pTm){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 0;
  return localtime_r(t);
}
#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
static int osLocaltime_s(time_t *t, struct tm *pTm){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
  return (int)localtime_s(t, pTm);
}
#else
static struct tm * osLocaltime(time_t *t){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 0;
  return localtime(t);
}
#endif
................................................................................
    y.h = sLocal.tm_hour;
    y.m = sLocal.tm_min;
    y.s = sLocal.tm_sec;
  }
#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
  {
    struct tm sLocal;
    if( 0!=osLocaltime_s(&t, &sLocal) ){
      sqlite3_result_error(pCtx, "error in localtime_s()", -1);
      *pRc = SQLITE_ERROR;
      return 0;
    }
    y.Y = sLocal.tm_year + 1900;
    y.M = sLocal.tm_mon + 1;
    y.D = sLocal.tm_mday;







|

|







 







|







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507

#ifdef HAVE_LOCALTIME_R
static struct tm * osLocaltime_r(time_t *t, struct tm *pTm){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 0;
  return localtime_r(t);
}
#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
static int osLocaltime_s(struct tm *pTm, time_t *t){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
  return (int)localtime_s(pTm, t);
}
#else
static struct tm * osLocaltime(time_t *t){
  if( sqlite3GlobalConfig.bLocaltimeFault ) return 0;
  return localtime(t);
}
#endif
................................................................................
    y.h = sLocal.tm_hour;
    y.m = sLocal.tm_min;
    y.s = sLocal.tm_sec;
  }
#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
  {
    struct tm sLocal;
    if( 0!=osLocaltime_s(&sLocal, &t) ){
      sqlite3_result_error(pCtx, "error in localtime_s()", -1);
      *pRc = SQLITE_ERROR;
      return 0;
    }
    y.Y = sLocal.tm_year + 1900;
    y.M = sLocal.tm_mon + 1;
    y.D = sLocal.tm_mday;