12202.1 Time in milliseconds - Microsoft Dynamics AX

This is a discussion on 12202.1 Time in milliseconds - Microsoft Dynamics AX ; I know how to get the time in seconds using timenow(). Is there a function that will give me the time in milliseconds? And it is not good enough to use something like timenow() * 1000. Any ideas? Regards, Morte ...

+ Reply
Results 1 to 8 of 8

Thread: 12202.1 Time in milliseconds

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.1 Time in milliseconds

    I know how to get the time in seconds using timenow(). Is there a function that will give me the time in milliseconds? And it is not good enough to use something like timenow() * 1000. Any ideas?

    Regards,
    Morte

    technet.navision.com Posting date: Saturday, March 19, 200

    technet.navision.com Posting path: General

  2. #2
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.4 Thanks

    I will take a look at the timer class.

    Morten

    technet.navision.com Posting date: Monday, March 21, 2005

    technet.navision.com Posting path: General

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.2 use this..

    static method somewhere in one of your classes.


    msecs are within 4 element of the container returend

    !!!
    !!! time is expressed in Coordinated Universal Time (UTC).
    !!!


    #DEFINE.MAXBUF(16)
    // returns a container which contains the current system time in UTC !!!!
    // 1st hours
    // 2nd minutes
    // 3rd seconds
    // 4th milliseconds
    static client Container GetSystemTimeAPI()
    {
    DLL _winApiDLL = new DLL('KERNEL32');
    DLLFunction _getSysTime = new DLLFunction(_winApiDLL, 'GetSystemTime');
    int dllret;
    Binary bin;
    Container ret;
    int whour;
    int wmin;
    int wsec;
    int wmsec;
    ;

    _getSysTime.returns(ExtTypes::void);
    _getSysTime.arg(ExtTypes::Pointer);

    bin = new Binary(#MAXBUF);
    _getSysTime.call(bin);
    ret = [bin.word(8), bin.word(10), bin.word(12), bin.word(14)];
    return ret;
    }

    regards

    linus

    technet.navision.com Posting date: Monday, March 21, 200

    technet.navision.com Posting path: General

  4. #4
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.7 Thank again

    What I need is the current time in millisconds, so I will go for the solution from linus.

    Thanks to both of you.

    Regards,
    Morte

    technet.navision.com Posting date: Wednesday, March 23, 200

    technet.navision.com Posting path: General

  5. #5
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.6 You're right

    You're absolutely right. I just assumed he wanted ms resolution for timing something.

    If you really need to know the CURRENT TIME in milliseconds, then you can't use the Timer class

    technet.navision.com Posting date: Wednesday, March 23, 200

    technet.navision.com Posting path: General

  6. #6
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.3 Timer class

    Or just use the timer class

    Andrew Jones

    technet.navision.com Posting date: Monday, March 21, 2005

    technet.navision.com Posting path: General

  7. #7
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.8 Worked perfect

    Hi linus!

    Thanks for the code, it worked fine. I used the dll-function GetLocalTime because I didn't want the time in UTC.

    Regards,
    Morte

    technet.navision.com Posting date: Tuesday, March 29, 200

    technet.navision.com Posting path: General

  8. #8
    Junior Member
    Join Date
    Aug 2010
    Posts
    0

    Default 12202.5 sorry..

    but using this class you're not able to obtains the current time (with msecs).

    Within that class the winapi getTickCount method is used which retrieves the number of milliseconds that have elapsed since Windows was started.

    maybe thats enough - but its not the current time (with msecs)

    regards

    linus

    technet.navision.com Posting date: Monday, March 21, 200

    technet.navision.com Posting path: General

+ Reply