SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Feb 2001
    Location
    Portland, OR, USA
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting the date and time of a remote machine

    The GetDateTime Function returns the date and time on the host machine. If I call a .dll function, will it return the system time on the remote machine?

    ------------------
    Bill Hull
    QA Engineer
    Timberline Software
    www.timberline.com

  2. #2
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    I'm puzzled...

    If you have a handle and connection to a remote machine, and are using the agent on said machine, would not the agent return the date/time of the machine on which it is running?

    ------------------

  3. #3
    Junior Member
    Join Date
    May 2001
    Location
    San Francisco ,CA,U.S.
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    I did it like this:
    string sReturn
    list of string lsOutput = {...}
    SYS_Execute("net time \\{sServerName}", lsOutput)
    sReturn = lsOutput[1]

    Then parse the string with the time.

    Best of luck,
    Lev.

    ------------------

  4. #4
    Junior Member
    Join Date
    Feb 2001
    Location
    Portland, OR, USA
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    Let me be a little more clear. According to the Silk documentation, the built-in GetDateTime function "captures the current date and time from the host system".
    I interpret this to mean that if I execute this while running scripts on a remote machine, I will be getting the date and time on the host machine.

    The problem I am having is that I am exporting and comparing reports during regression. The reports have the date and time in the page header.

    I would like to be able to get date and time on the remote machine, set the date and time to constant value, print reports, then restore the date and time to the original values.

    I am hoping that I can call the functions in kernel32.dll to get and set the system time on the remote machines.

    Has anyone tried this?
    change

    ------------------
    Bill Hull
    QA Engineer
    Timberline Software
    www.timberline.com

  5. #5
    Member
    Join Date
    Jan 2001
    Location
    Westborough, mA, USa
    Posts
    91
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    Using the dll from the kernel32.dll will also return the DateTime of the host machine. I have tried that. If you can write a script which clicks the TaskManager and changes the time, it will change the time on the machine where the agent is present.
    Regards

    ------------------

  6. #6
    Senior Member
    Join Date
    Jul 2001
    Location
    Ithaca, NY, USA
    Posts
    199
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    Will,
    Yes that should work just nicely. Any call of a function in a dll on the remote machine will return you values of it.

    ------------------
    Don't blame the QA testers!
    Convenience is the first step to enslave yourself. Freedom is inconvenient.

  7. #7
    Member
    Join Date
    Nov 2000
    Location
    Dublin, Ireland
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting the date and time of a remote machine

    I have used the SetLocalTime and GetLocalTime functions in kernal32.dll remotely. Any user function that does not return a value can be executed remotely. So my remote functions use inout arguments instead of returning a value.

    I had originally used the GetSystemTime and SetSystemTime functions but I found out that these functions do not make timezone or daylight saving time adjustments so they can give different results on different machines. Where as the LocalTime functions make these adjustments.


    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:32 PM.

Copyright BetaSoft Inc.