Exemple #1
0
		internal static long JavaDateToClrTicks(java.util.Date d) {
			long millis = JavaMillisToClrMillis(d.getTime());
			if (DEFAULT_TIME_ZONE.inDaylightTime(d)) {
				millis += DEFAULT_TIME_ZONE.getDSTSavings();
			}
			return millis * TimeSpan.TicksPerMillisecond;
		}
Exemple #2
0
		internal static long JavaTimeToClrTicks(java.sql.Time t) {
			return (t.getTime() + DEFAULT_TIME_ZONE.getRawOffset())
				* TimeSpan.TicksPerMillisecond;
		}
Exemple #3
0
        /// <summary>
        /// Converts a Java Date value to a DateTime value
        /// </summary>
        /// <param name="javaDate">The Java date</param>
        /// <returns></returns>
        private static DateTime FromJavaDate(java.util.Date javaDate)
        {
            if (_configTimeZone == null)
            {
                // Read time zone from market-hours-config
                _configTimeZone = MarketHoursDatabase.FromDataFolder().GetDataTimeZone("fxcm", "*", SecurityType.Forex);
            }

            // Convert javaDate to UTC Instant (Epoch)
            var instant = Instant.FromSecondsSinceUnixEpoch(javaDate.getTime() / 1000);

            // Convert to configured TZ then to a .Net DateTime
            return instant.InZone(_configTimeZone).ToDateTimeUnspecified();
        }