Skip to content

Commit

Permalink
Fix for ODBC-192. Incorrect conversion of time values when retrieved …
Browse files Browse the repository at this point in the history
…as string
  • Loading branch information
alexpotapchenko committed Dec 29, 2015
1 parent 75d8d99 commit 81d2de8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions OdbcConvert.cpp
Expand Up @@ -2112,7 +2112,7 @@ int OdbcConvert::convTimeToString(DescRecord * from, DescRecord * to)
int len, outlen = to->length;

if ( nnano )
len = snprintf(pointer, outlen, "%02d:%02d:%02d.%lu",hour, minute, second, nnano);
len = snprintf(pointer, outlen, "%02d:%02d:%02d.%04lu",hour, minute, second, nnano);
else
len = snprintf(pointer, outlen, "%02d:%02d:%02d",hour, minute, second);

Expand Down Expand Up @@ -2144,7 +2144,7 @@ int OdbcConvert::convTimeToStringW(DescRecord * from, DescRecord * to)
int len, outlen = to->length / sizeof( wchar_t );

if ( nnano )
len = swprintf(pointer, outlen, L"%02d:%02d:%02d.%lu",hour, minute, second, nnano);
len = swprintf(pointer, outlen, L"%02d:%02d:%02d.%04lu",hour, minute, second, nnano);
else
len = swprintf(pointer, outlen, L"%02d:%02d:%02d",hour, minute, second);

Expand Down Expand Up @@ -2308,7 +2308,7 @@ int OdbcConvert::convDateTimeToString(DescRecord * from, DescRecord * to)
int len, outlen = to->length;

if ( nnano )
len = snprintf(pointer, outlen, "%04d-%02d-%02d %02d:%02d:%02d.%lu",year,month,mday,hour, minute, second, nnano);
len = snprintf(pointer, outlen, "%04d-%02d-%02d %02d:%02d:%02d.%04lu",year,month,mday,hour, minute, second, nnano);
else
len = snprintf(pointer, outlen, "%04d-%02d-%02d %02d:%02d:%02d",year,month,mday,hour, minute, second);

Expand Down Expand Up @@ -2344,7 +2344,7 @@ int OdbcConvert::convDateTimeToStringW(DescRecord * from, DescRecord * to)
int len, outlen = to->length / sizeof( wchar_t );

if ( nnano )
len = swprintf( pointer, outlen, L"%04d-%02d-%02d %02d:%02d:%02d.%lu",year,month,mday,hour, minute, second, nnano );
len = swprintf( pointer, outlen, L"%04d-%02d-%02d %02d:%02d:%02d.%04lu",year,month,mday,hour, minute, second, nnano );
else
len = swprintf( pointer, outlen, L"%04d-%02d-%02d %02d:%02d:%02d",year,month,mday,hour, minute, second );

Expand Down

0 comments on commit 81d2de8

Please sign in to comment.