Index: openacs-4/packages/ref-timezones/ref-timezones.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-timezones/ref-timezones.info,v diff -u -r1.5 -r1.6 --- openacs-4/packages/ref-timezones/ref-timezones.info 17 May 2003 11:09:18 -0000 1.5 +++ openacs-4/packages/ref-timezones/ref-timezones.info 18 Aug 2003 10:37:03 -0000 1.6 @@ -7,7 +7,7 @@ f t - + oracle postgresql @@ -19,7 +19,7 @@ This is the timezone data for the reference data package. - + Index: openacs-4/packages/ref-timezones/sql/postgresql/ref-timezones-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-timezones/sql/postgresql/ref-timezones-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ref-timezones/sql/postgresql/ref-timezones-create.sql 16 Jul 2003 00:06:54 -0000 1.7 +++ openacs-4/packages/ref-timezones/sql/postgresql/ref-timezones-create.sql 18 Aug 2003 10:37:03 -0000 1.8 @@ -192,6 +192,28 @@ end;' language 'plpgsql'; +create or replace function timezone__convert_to_local (integer, varchar) returns timestamptz as ' +declare + p_tz_id alias for $1; + p_utc_varchar alias for $2; + v_base_time timestamptz; +begin + + select "timestamptz" (p_utc_varchar || substr(gmt_offset,1,5)) into v_base_time + from timezones + where tz_id = p_tz_id; + + if not found then + return "timestamptz" (p_utc_varchar || ''+00''); + end if; + + return "timestamptz" (p_utc_varchar) + "interval" (gmt_offset || ''seconds'') + from timezone_rules + where tz_id = p_tz_id and v_base_time between utc_start and utc_end; + +end;' language 'plpgsql'; + + create or replace function timezone__get_offset (integer, timestamptz) returns interval as ' declare p_tz_id alias for $1;