Author: jreidinger Date: Mon Jun 22 14:43:36 2009 New Revision: 57681 URL: http://svn.opensuse.org/viewcvs/yast?rev=57681&view=rev Log: rewrite reading api of time to new standards (and simplify it to one function (one access right)) Modified: trunk/country/timezone/src/YaPI/TIME.pm Modified: trunk/country/timezone/src/YaPI/TIME.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/YaPI/TIME.pm?rev=57681&r1=57680&r2=57681&view=diff ============================================================================== --- trunk/country/timezone/src/YaPI/TIME.pm (original) +++ trunk/country/timezone/src/YaPI/TIME.pm Mon Jun 22 14:43:36 2009 @@ -14,38 +14,30 @@ our @CAPABILITIES = ('SLES9'); our %TYPEINFO; -BEGIN{$TYPEINFO{GetZoneMap} = ["function", - ["list",["map","string","string"]]]; +BEGIN{$TYPEINFO{Read} = ["function", + ["map","string","any"],["map","string","string"]]; } -sub GetZoneMap { +sub Read { + my $self = shift; + my $args = shift; 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"; + if ($args->{"zones"} eq "true") + { + $ret->{"zone"} = Timezone->get_zonemap(); + } + if ($args->{"utcstatus"} eq "true"){ + if (Timezone->utc_only()){ + $ret->{"utcstatus"} = "UTConly"; + } elsif (Timezone->hwclock eq "-u") { + $ret->{"utcstatus"} = "UTC"; + } else { + $ret->{"utcstatus"} = "local"; } - $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)); + if ($args->{"currenttime"} eq "true"){ + $ret->{"time"} = Timezone->GetDateTime(YaST::YCP::Boolean(1),YaST::YCP::Boolean(0)); + } + return $ret; } - 1; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org