Author: jreidinger Date: Fri Jun 12 13:53:36 2009 New Revision: 57545 URL: http://svn.opensuse.org/viewcvs/yast?rev=57545&view=rev Log: initial YaPI for time, zonemap doesn't return due to bug into yast dbus Added: trunk/country/timezone/src/YaPI/ trunk/country/timezone/src/YaPI/TIME.pm Modified: trunk/country/timezone/src/Makefile.am Modified: trunk/country/timezone/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/Makefile.am?rev=57545&r1=57544&r2=57545&view=diff ============================================================================== --- trunk/country/timezone/src/Makefile.am (original) +++ trunk/country/timezone/src/Makefile.am Fri Jun 12 13:53:36 2009 @@ -22,7 +22,12 @@ rnc_DATA = timezone.rnc -EXTRA_DIST = $(client_DATA) $(module_DATA) $(desktop_DATA) $(ynclude_DATA) $(rnc_DATA) +YaPI_perldir = @moduledir@/YaPI + +YaPI_perl_DATA = \ + YaPI/TIME.pm + +EXTRA_DIST = $(client_DATA) $(module_DATA) $(desktop_DATA) $(ynclude_DATA) $(YaPI_perl_DATA) $(rnc_DATA) YCPCFLAGS = -M ../../language/src/modules Added: trunk/country/timezone/src/YaPI/TIME.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/YaPI/TIME.pm?rev=57545&view=auto ============================================================================== --- trunk/country/timezone/src/YaPI/TIME.pm (added) +++ trunk/country/timezone/src/YaPI/TIME.pm Fri Jun 12 13:53:36 2009 @@ -0,0 +1,51 @@ +package YaPI::TIME; + +use strict; +use YaST::YCP qw(Boolean); +use YaPI; + +textdomain("time"); + +# ------------------- imported modules +YaST::YCP::Import ("Timezone"); +# ------------------------------------- + +our $VERSION = '1.0.0'; +our @CAPABILITIES = ('SLES9'); +our %TYPEINFO; + +BEGIN{$TYPEINFO{GetZoneMap} = ["function", + ["list",["map","string","string"]]]; +} +sub GetZoneMap { + my $ret = []; + my $zones = Timezone->get_zonemap(); +#code entries to one string for dbus limitation + foreach my $zone (@$zones){ + my $finalstring = ""; + while ( my ($key, $value) = each (%{$zone->{"entries"}})){ + $finalstring = "$finalstring;$key->$value"; + } + $zone->{"entries"} = $finalstring; + } + return $zones; +} + +BEGIN{$TYPEINFO{UTCStatus} = ["function", + "string"]; +} +sub UTCStatus { + return "UTConly" if (Timezone->utc_only()); + return "UTC" if (Timezone->hwclock eq "-u"); + return "local"; +} + +BEGIN{$TYPEINFO{GetTime} = ["function", + "string"]; +} +sub GetTime { + return Timezone->GetDateTime(YaST::YCP::Boolean(1),YaST::YCP::Boolean(0)); +} + + +1; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org