How to create a GLib.TimeVal from timestamp?
        Posted  
        
            by 
                fluteflute
            
        on Ask Ubuntu
        
        See other posts from Ask Ubuntu
        
            or by fluteflute
        
        
        
        Published on 2012-07-03T08:27:11Z
        Indexed on 
            2012/07/03
            9:23 UTC
        
        
        Read the original article
        Hit count: 351
        
I have a value such as 'timestamp' below, where the last three digits correspond to milliseconds.
timestamp = 1340830988768
I currently have code that looks like the following:
import indicate
indicator = indicate.Indicator()
indicator.set_property_time("time", int(timestamp[:-3]))
I want to amend it to use:
from gi.repository import Indicate
indicator = Indicate.Indicator()
However, the new version of set_property_time requires the second parameter to be a GLib.TimeVal. How do I create a GLib.TimeVal from my timestamp? Millisecond precision is not important for this application.
© Ask Ubuntu or respective owner