Fix for N_SE-47477
[apps/osp/Call.git] / src / CalllogManager.cpp
index 8b0bd29..98dc827 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -18,8 +18,9 @@
  * @file       CalllogManager.cpp
  * @brief      This class provides call log APIs
  */
-#include "CalllogManager.h"
 #include <FLocales.h>
+#include "CallApp.h"
+#include "CalllogManager.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -124,14 +125,17 @@ CallLogManager::AddCallogInfoToDatabase(AppCallInfo* calllogInfo)
                else
                {
                        //start time is in miliseconds . so convert to seconds and set it to time_t format.
-                       long long connectTime = calllogInfo->GetCallConnectTime();
+                       long long connectTime = calllogInfo->GetDurationTime();
                        if(connectTime == 0 || connectTime < 0)
                        {
-                               connectTime = time(null);
+                               //connectTime = time(null);
+                               CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
+                               connectTime = pPhoneApp->GetCallAppTicks();
+                               connectTime /=1000;
                        }
                        else
                        {
-                               connectTime = calllogInfo->GetCallConnectTime()/ 1000;
+                               connectTime = calllogInfo->GetDurationTime()/ 1000;
                        }
                        duration = (int)GetDuration(connectTime);
                }
@@ -196,9 +200,12 @@ CallLogManager::AddCallogInfoToDatabase(AppCallInfo* calllogInfo)
 unsigned long
 CallLogManager::GetDuration(long long start_time)
 {
-       time_t curr_time;
+       long long curr_time;
        unsigned long call_duration_in_sec = 50;
-       curr_time = time(0);
+//     curr_time = time(0);
+       CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
+       curr_time = pPhoneApp->GetCallAppTicks();
+       curr_time /=1000;
        /*if(start_time != 0)
        {
                start_time /= 1000;