[Calendar] Fix time struct for allday union 15/158815/2
authorJeesun Kim <iamjs.kim@samsung.com>
Fri, 3 Nov 2017 07:27:50 +0000 (16:27 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Mon, 6 Nov 2017 01:04:04 +0000 (01:04 +0000)
Change-Id: I01c381a3cf8760a41558b2064335f4d70d9273ec

src/Tizen.Pims.Calendar/Interop/Interop.Record.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs

index be79a6a..771bf1f 100644 (file)
@@ -22,16 +22,24 @@ internal static partial class Interop
     internal static partial class Record
     {
         [StructLayout(LayoutKind.Sequential)]
+        internal unsafe struct LOCAL
+        {
+            internal int year;
+            internal int month;
+            internal int mday;
+            internal int hour;
+            internal int minute;
+            internal int second;
+        };
+        [StructLayout(LayoutKind.Explicit)]
             internal struct DateTime
             {
+                [FieldOffset(0)]
                 internal int type;
+                [FieldOffset(8)]
                 internal long utime;
-                internal int year;
-                internal int month;
-                internal int mday;
-                internal int hour;
-                internal int minute;
-                internal int second;
+                [FieldOffset(8)]
+                internal LOCAL local;
             };
 
         [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_create")]
index a97ab83..89d32c8 100644 (file)
@@ -168,12 +168,12 @@ namespace Tizen.Pims.Calendar
             }
             else
             {
-                time.year = value.LocalTime.Year;
-                time.month = value.LocalTime.Month;
-                time.mday = value.LocalTime.Day;
-                time.hour = value.LocalTime.Hour;
-                time.minute = value.LocalTime.Minute;
-                time.second = value.LocalTime.Second;
+                time.local.year = value.LocalTime.Year;
+                time.local.month = value.LocalTime.Month;
+                time.local.mday = value.LocalTime.Day;
+                time.local.hour = value.LocalTime.Hour;
+                time.local.minute = value.LocalTime.Minute;
+                time.local.second = value.LocalTime.Second;
             }
             return time;
         }
@@ -188,7 +188,7 @@ namespace Tizen.Pims.Calendar
             }
             else
             {
-                value = new CalendarTime(time.year, time.month, time.mday, time.hour, time.minute, time.second);
+                value = new CalendarTime(time.local.year, time.local.month, time.local.mday, time.local.hour, time.local.minute, time.local.second);
             }
             value._type = time.type;
             return value;