Forum Discussion

Zdenda's avatar
Zdenda
Icon for Cirrus rankCirrus
Feb 23, 2018

API Rest, what lastUpdateMicros is?

Hi,

what is parameter "lastUpdateMicros" and can I get real daytime from that?

I need to know since when some ASM objects are in staging and although I can see real daytime in GUI, in API I see only lastUpdateMicros like here:

{   u'allowed': True,
        u'checkPostDataLength': True,
        u'checkQueryStringLength': True,
        u'checkRequestLength': True,
        u'checkUrlLength': True,
        u'id': u'w2u9JYt-5pTrmHIhsrGXsA',
        u'kind': u'tm:asm:policies:filetypes:filetypestate',
        u'lastUpdateMicros': 1519382317000000.0,
        u'name': u'jpg',
        u'performStaging': True,
        u'postDataLength': 1000,
        u'queryStringLength': 1000,
        u'requestLength': 5000,
        u'responseCheck': False,
        u'selfLink': u'https://localhost/mgmt/tm/asm/policies/9gV6OhNsX7jnw9sPSfRGmQ/filetypes/w2u9JYt-5pTrmHIhsrGXsA?ver=12.1.2',
        u'type': u'explicit',
        u'urlLength': 100}

Thanks, Zdenek

3 Replies

  • lastUpdateMicros
    is the date/time represented in micro seconds since 1970-01-01 00:00:00 GMT (Unix epoch). For example, 1519382317000000 is Friday, 23 February 2018 10:38:37.

    There are several ways to convert. If you want to do it from a BIG-IP bash, JavaScript/Node might be handy. Note that the JavaScript's

    Date
    expects milliseconds, so trim the last three digits. e.g.,

    [root@ltm1300:Active:Disconnected] config  node
    > d = new Date(1519382317000)
    Fri Feb 23 2018 23:38:37 GMT+1300 (NZDT)
    
  • P.S. This one is easier. Trim the last six digits.

    [root@ltm1300:Active:In Sync] config  date --date=@1519382317
    Fri Feb 23 23:38:37 NZDT 2018
    
  • How about this?

    root@ltm1300:Active:In Sync] config  python
    ...
    >>> import datetime
    >>> datetime.datetime.fromtimestamp(1519382317).__str__()
    '2018-02-23 23:38:37'
    

    Bonus: perl version 🙂

    [root@ltm1300:Active:In Sync] config  perl -e 'use POSIX; print strftime("%Y/%m/%d %H:%M:%S\n", localtime(1519382317))'
    2018/02/23 23:38:37