webservices: Strip trailing zeros from time fraction.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-10-12 15:30:19 +02:00 committed by Alexandre Julliard
parent 9d248938ed
commit 6cd80610c8
2 changed files with 5 additions and 1 deletions

View File

@ -2588,6 +2588,8 @@ static void test_datetime(void)
{ 1, WS_DATETIME_FORMAT_UTC, S_OK, "<t>0001-01-01T00:00:00.0000001Z</t>" },
{ 1, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T00:00:00.0000001+00:00</t>" },
{ 1, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.0000001</t>" },
{ 10, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.000001</t>" },
{ 1000000, WS_DATETIME_FORMAT_NONE, S_OK, "<t>0001-01-01T00:00:00.1</t>" },
{ 0x23c34600, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T00:01:00+00:00</t>" },
{ 0x861c46800, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T01:00:00+00:00</t>" },
{ 0x430e234000, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>0001-01-01T08:00:00+00:00</t>" },
@ -2636,7 +2638,8 @@ static void test_datetime(void)
ok( hr == tests[i].hr, "%u: got %08x\n", i, hr );
if (hr == S_OK)
{
ok( check_result( writer, tests[i].result ) || broken(check_result( writer, tests[i].result2 )),
ok( check_result( writer, tests[i].result ) ||
(tests[i].result2 && broken(check_result( writer, tests[i].result2 ))),
"%u: wrong result\n", i );
}
}

View File

@ -1235,6 +1235,7 @@ static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf )
{
static const char fmt_frac[] = ".%07u";
len += sprintf( (char *)buf + len, fmt_frac, sec_frac );
while (buf[len - 1] == '0') len--;
}
if (ptr->format == WS_DATETIME_FORMAT_UTC)
{