From 075bd59947dcacfd9b4055a95162eb3c3e13bd51 Mon Sep 17 00:00:00 2001 From: pvschakradhar <48746416+pvschakradhar@users.noreply.github.com> Date: Thu, 30 Apr 2020 09:32:58 +0530 Subject: [PATCH] changed dataType of time for compatibility with native layer (#1583) changed dataType of time for compatibility with native layer --- src/Tizen.System.PowerUsage/Interop/Interop.PowerUsage.cs | 8 ++++---- src/Tizen.System.PowerUsage/PowerUsage/PowerUsage.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Tizen.System.PowerUsage/Interop/Interop.PowerUsage.cs b/src/Tizen.System.PowerUsage/Interop/Interop.PowerUsage.cs index fc16a52..d8a3c58 100644 --- a/src/Tizen.System.PowerUsage/Interop/Interop.PowerUsage.cs +++ b/src/Tizen.System.PowerUsage/Interop/Interop.PowerUsage.cs @@ -29,15 +29,15 @@ internal static partial class Interop internal static extern int UsageDataGetPowerUsagePerResource(IntPtr dataHandle, PowerUsageResourceType rtype, out double batteryUsage); [DllImport(Libraries.PowerUsage, EntryPoint = "battery_monitor_get_power_usage_by_app_for_all_resources")] - internal static extern int GetPowerUsageByAppForAllResources(string appID, long startTime, long endTime, out IntPtr dataHandle); + internal static extern int GetPowerUsageByAppForAllResources(string appID, int startTime, int endTime, out IntPtr dataHandle); [DllImport(Libraries.PowerUsage, EntryPoint = "battery_monitor_get_power_usage_by_app_per_resource")] - internal static extern int GetPowerUsageByAppPerResource(string appID, PowerUsageResourceType rtype, long startTime, long endTime, out double batteryUsage); + internal static extern int GetPowerUsageByAppPerResource(string appID, PowerUsageResourceType rtype, int startTime, int endTime, out double batteryUsage); [DllImport(Libraries.PowerUsage, EntryPoint = "battery_monitor_get_power_usage_by_app")] - internal static extern int GetPowerUsageByApp(string appID, long startTime, long endTime, out double batteryUsage); + internal static extern int GetPowerUsageByApp(string appID, int startTime, int endTime, out double batteryUsage); [DllImport(Libraries.PowerUsage, EntryPoint = "battery_monitor_get_power_usage_by_resource")] - internal static extern int GetPowerUsageByResource(PowerUsageResourceType rtype, long startTime, long endTime, out double batteryUsage); + internal static extern int GetPowerUsageByResource(PowerUsageResourceType rtype, int startTime, int endTime, out double batteryUsage); } } \ No newline at end of file diff --git a/src/Tizen.System.PowerUsage/PowerUsage/PowerUsage.cs b/src/Tizen.System.PowerUsage/PowerUsage/PowerUsage.cs index 722f78c..aad0740 100644 --- a/src/Tizen.System.PowerUsage/PowerUsage/PowerUsage.cs +++ b/src/Tizen.System.PowerUsage/PowerUsage/PowerUsage.cs @@ -85,7 +85,7 @@ namespace Tizen.System IDictionary batteryUsage = new Dictionary(); try { - PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByAppForAllResources(appID, ((DateTimeOffset)start).ToUnixTimeSeconds(), ((DateTimeOffset)end).ToUnixTimeSeconds(), out dataHandle); + PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByAppForAllResources(appID, Convert.ToInt32(((DateTimeOffset)start).ToUnixTimeSeconds()), Convert.ToInt32(((DateTimeOffset)end).ToUnixTimeSeconds()), out dataHandle); if (ret != PowerUsageError.None) { Log.Error(PowerUsageErrorFactory.LogTag, "Error getting battery usage for all resources" + ret); @@ -141,7 +141,7 @@ namespace Tizen.System public static double GetPowerUsage(string appID, PowerUsageResourceType rtype, DateTime start, DateTime end) { double batteryUsage = 0; - PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByAppPerResource(appID, rtype, ((DateTimeOffset)start).ToUnixTimeSeconds(), ((DateTimeOffset)end).ToUnixTimeSeconds(), out batteryUsage); + PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByAppPerResource(appID, rtype, Convert.ToInt32(((DateTimeOffset)start).ToUnixTimeSeconds()), Convert.ToInt32(((DateTimeOffset)end).ToUnixTimeSeconds()), out batteryUsage); if (ret != PowerUsageError.None) { if (ret == PowerUsageError.RecordNotFound) @@ -175,7 +175,7 @@ namespace Tizen.System public static double GetPowerUsage(string appID, DateTime start, DateTime end) { double batteryUsage = 0; - PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByApp(appID, ((DateTimeOffset)start).ToUnixTimeSeconds(), ((DateTimeOffset)end).ToUnixTimeSeconds(), out batteryUsage); + PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByApp(appID, Convert.ToInt32(((DateTimeOffset)start).ToUnixTimeSeconds()), Convert.ToInt32(((DateTimeOffset)end).ToUnixTimeSeconds()), out batteryUsage); if (ret != PowerUsageError.None) { Log.Error(PowerUsageErrorFactory.LogTag, "Error getting battery usage by app," + ret); @@ -201,7 +201,7 @@ namespace Tizen.System public static double GetPowerUsage(PowerUsageResourceType rtype, DateTime start, DateTime end) { double batteryUsage = 0; - PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByResource(rtype, ((DateTimeOffset)start).ToUnixTimeSeconds(), ((DateTimeOffset)end).ToUnixTimeSeconds(), out batteryUsage); + PowerUsageError ret = (PowerUsageError)Interop.PowerUsage.GetPowerUsageByResource(rtype, Convert.ToInt32(((DateTimeOffset)start).ToUnixTimeSeconds()), Convert.ToInt32(((DateTimeOffset)end).ToUnixTimeSeconds()), out batteryUsage); if (ret != PowerUsageError.None) { if (ret == PowerUsageError.RecordNotFound) -- 2.7.4