×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Question Get log event time (missed call)

    Hi all,

    I want to get the time of the last missed call :-
    Code:
    CallLogMissed = logs.calls(mode='missed')[0] #last missed call event
    MCTime =time.strftime("%I:%M %d %m at ", time.localtime(CallLogMissed ['time'])) # Its time
    print MCTime
    The problem is it returns me the hours delayed 2 hours exactly; Minutes and day and month is correct , so what is wrong in my code ??

    Many thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Get log event time (missed call)

    Does time set correct in your phone ?

    Otherwise add two in the formula, so that delayed time is increased by two again and final result is correct time.

  3. #3
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Get log event time (missed call)

    Hi rahulvala,

    How can I add two in formula ??

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Get log event time (missed call)

    Use the below line instead of your line and check what is the output :

    Code:
    MCTime =time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(CallLogMissed ["time"]))

  5. #5
    Nokia Developer Champion
    Join Date
    Sep 2007
    Location
    Bhavnagar
    Posts
    928

    Re: Get log event time (missed call)

    Hi,
    There is lots of discussion on the same issue related to time. If you can try to find on this DiBo than you will definately get some help from there.
    Jajal Mehul

  6. #6
    Registered User
    Join Date
    Jul 2008
    Posts
    20

    Re: Get log event time (missed call)

    Hi,

    seems to me that you have to take timezone into account... And you need to take many different options into account... The main documentation for this is:

    http://docs.python.org/library/time.html

    Here is a a function to get all options into account (if I don't have make too much error...):

    Code:
    import time
    def local_time_offset ():
        'returns the local time offset'
    
        if time.localtime ().tm_isdst == -1:
            #  tm_isdst is not working, so we compute directly the timezone using
            #  the gmtime...
            tz = int (time.mktime (time.gmtime ())
                      - time.mktime (time.localtime ())
                     ) / 100 * 100
        elif time.localtime ().tm_isdst and time.daylight:
            tz = time.altzone
        else:
            tz = time.timezone
            
        return tz
    Then, you can write:

    Code:
    MCTime =time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(CallLogMissed ["time"] - local_time_offset()))
    This works on PyS60 2.0.0 and 1.4.5.

    Note: if you take the solution to add two, this will be not good, has this will change depending on the timezone and DST.

    HTH.

    Happy coding.

    --
    Olivier

  7. #7
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Get log event time (missed call)

    Hi bornet, Many thanks for your answer and your help

    In PyS60 documentation : -

    When I try to get the time of received sms it works fine :
    time(sms id)
    Retrieve the SMS message time of arrival in seconds since epoch.

    For Logs event time :
    time: The time associated with the event as a unix timestamp.


    What is the difference ?? Isn't suppose that log record the time of calls event, and all I have to do is just using a function that convert these seconds into readable time (hours,min,sec, etc) ?? why would I care about all this garbage of time zone and DST as long as the system taking care of it and record the time in under event tim ???
    Last edited by ashraf fawzy; 2010-09-26 at 21:03. Reason: correcting information

  8. #8
    Registered User
    Join Date
    May 2010
    Location
    Egypt
    Posts
    433

    Re: Get log event time (missed call)

    Hi bornet,

    Many thanks for your lovely code , it works fine.

    Your help is really appreciated.

  9. #9
    Registered User
    Join Date
    Jul 2008
    Posts
    20

    Re: Get log event time (missed call)

    Hi,

    the PyS60 API is not consistent at all. For your example, the time of the sms can be found using either the inbox or the log module. Inbox module seems to take the timezone into account directly, while the log module not:

    Code:
    >>> import time
    >>> import inbox
    >>> import logs
    >>> i = inbox.Inbox()
    >>> time.localtime (i.time(i.sms_messages()[0]))
    (2010, 9, 27, 11, 8, 53, 0, 270, -1)
    >>> time.localtime (logs.sms()[0]['time'])
    (2010, 9, 27, 9, 8, 53, 0, 270, -1)
    Have a nice day.

    --
    Olivier

Similar Threads

  1. Replies: 0
    Last Post: 2010-08-18, 07:03
  2. "Missed call" Call Log Problem
    By nadis in forum Symbian
    Replies: 2
    Last Post: 2010-07-30, 07:37
  3. Missed Call Log Entry Creation
    By yogesh.bhople in forum Symbian
    Replies: 3
    Last Post: 2010-07-21, 12:19
  4. how can i generate an event on missed call!
    By jackofall in forum Mobile Java General
    Replies: 2
    Last Post: 2009-04-01, 13:52
  5. 3650 losing time on missed call log
    By antony.john in forum Symbian
    Replies: 0
    Last Post: 2003-10-05, 16:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×