Examples of HostDateTimeSystem


Examples of com.vmware.vim25.mo.HostDateTimeSystem

    {
      System.out.println("Cannot find the host:" + hostname);
      si.getServerConnection().logout();
      return;
    }
    HostDateTimeSystem hdts = host.getHostDateTimeSystem();
   
    HostDateTimeInfo info = hdts.getDateTimeInfo();

    System.out.println("The NTP Servers:");
    HostNtpConfig cfg = info.getNtpConfig();
    String[] svrs = cfg.getServer();
    for(int i=0; svrs!=null && i<svrs.length; i++)
    {
      System.out.println("Server["+i+"]:" + svrs[i]);
    }
   
    System.out.println("\nCurrent Time Zone:");
    HostDateTimeSystemTimeZone tz = info.getTimeZone();
    System.out.println("Key:" + tz.getKey());
    System.out.println("Name:" + tz.getName());
    // the GMT offset is in seconds.
    // for example, America/Los_Angeles, -28800
    System.out.println("GmtOffset:" + tz.getGmtOffset());
    System.out.println("Description:" + tz.getDescription());
   
    Calendar curTime = si.currentTime();
    System.out.println("\nCurrent time:" + curTime.getTime());
    //roll back one hour
    curTime.roll(Calendar.HOUR, false);
    hdts.updateDateTime(curTime);
   
    curTime = si.currentTime();
    System.out.println("Current time (after):"
        + curTime.getTime());

    // reset the time
    curTime.roll(Calendar.HOUR, true);
    hdts.updateDateTime(curTime);
   
    si.getServerConnection().logout();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.