Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmallsql <smallsql>2011-01-25 15:59:38 +0300
committersmallsql <smallsql>2011-01-25 15:59:38 +0300
commit196359aecc522d16b8e7ca29b0cd9f6986706173 (patch)
treefe24c095ae396511c0d060c59aa5b84587538745 /openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
parentf8dbce7789c322bd908a44e1567bee8688f15750 (diff)
Fix for the timezone used to convert .NET DateTime to Java Timezone in the JDBC-ODBC bridge.
Diffstat (limited to 'openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java')
-rw-r--r--openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java b/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
index 9e1db01e..c5497e30 100644
--- a/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
+++ b/openjdk/sun/jdbc/odbc/JdbcOdbcUtils.java
@@ -1,5 +1,6 @@
/*
Copyright (C) 2009, 2010 Volker Berlin (i-net software)
+ Copyright (C) 2011 Karsten Heinrich (i-net software)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -105,7 +106,7 @@ public class JdbcOdbcUtils{
return new BigDecimal(((cli.System.Decimal)obj).ToString(CultureInfo.get_InvariantCulture()));
}
if(obj instanceof cli.System.DateTime){
- return new Timestamp(getJavaMillis((cli.System.DateTime)obj));
+ return convertDateTimeToTimestamp((cli.System.DateTime)obj);
}
if(obj instanceof cli.System.TimeSpan){
cli.System.TimeSpan ts = (cli.System.TimeSpan)obj;
@@ -117,6 +118,18 @@ public class JdbcOdbcUtils{
return obj;
}
+ /**
+ * Converts a .NET DateTime to a Timestamp in the current Timezone
+ * @param obj the dateTime
+ * @return the conveted time stamp
+ */
+ public static Timestamp convertDateTimeToTimestamp( cli.System.DateTime obj) {
+ long javaMillis = getJavaMillis(obj);
+ int seconds = (int)(javaMillis / 1000);
+ int nanos = (int)((javaMillis % 1000) * 1000000);
+ return new Timestamp( 70, 0, 1, 0, 0, seconds, nanos );
+ }
+
/**
* Convert a Java Object in the equals .NET Object.