added: a new directory "etc"
there'll be some generic config files for winix added: a new file in etc directory: time_zones_file list of time zones (not finished yet -- daylight saving time is needed) added: option to config: etc_dir a directory in which there are some config files used mainly when winix starts default: empty (means not for using) added: option to config: time_zones_file a file in etc_dir with time zones info default: time_zones.conf this is a Space structure with all time zones added: to system: TimeZones struct list of time zones read from etc/time_zones.conf git-svn-id: svn://ttmath.org/publicrep/winix/trunk@849 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -324,9 +324,120 @@ void strnc(Info & i)
|
||||
|
||||
|
||||
|
||||
static size_t tz_index;
|
||||
|
||||
void winix_tz_tab(Info & i)
|
||||
{
|
||||
tz_index = i.iter;
|
||||
|
||||
i.res = tz_index < system->time_zones.Size();
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_id(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
i.out << system->time_zones[tz_index].time_zone.tz_id;
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_name(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
{
|
||||
std::wstring & key = system->time_zones[tz_index].name_key;
|
||||
i.out << locale.Get(key); // !! IMPROVE ME which locale?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_offset_sec(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
i.out << system->time_zones[tz_index].time_zone.tz_offset;
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_offset_hour_min(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
{
|
||||
time_t offset = system->time_zones[tz_index].time_zone.tz_offset;
|
||||
|
||||
if( offset < 0 )
|
||||
{
|
||||
i.out << '-';
|
||||
offset = -offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
i.out << '+';
|
||||
}
|
||||
|
||||
print_hour_min(i, offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_has_dst(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
i.res = system->time_zones[tz_index].time_zone.tz_has_dst;
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_dst_offset_sec(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
i.out << system->time_zones[tz_index].time_zone.tz_dst_offset;
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_dst_offset_hour_min(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
{
|
||||
time_t offset = system->time_zones[tz_index].time_zone.tz_dst_offset;
|
||||
|
||||
if( offset < 0 )
|
||||
{
|
||||
i.out << '-';
|
||||
offset = -offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
i.out << '+';
|
||||
}
|
||||
|
||||
print_hour_min(i, offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_dst_start(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
{
|
||||
PT::Date & date = system->time_zones[tz_index].time_zone.tz_dst_start;
|
||||
|
||||
date.SerializeMonthDay(i.out);
|
||||
i.out << ' ';
|
||||
date.SerializeHourMin(i.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void winix_tz_tab_dst_end(Info & i)
|
||||
{
|
||||
if( tz_index < system->time_zones.Size() )
|
||||
{
|
||||
PT::Date & date = system->time_zones[tz_index].time_zone.tz_dst_end;
|
||||
|
||||
date.SerializeMonthDay(i.out);
|
||||
i.out << ' ';
|
||||
date.SerializeHourMin(i.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user