Index: openacs-4/packages/ref-timezones/sql/oracle/ref-timezones-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-timezones/sql/oracle/ref-timezones-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ref-timezones/sql/oracle/ref-timezones-create.sql 15 Oct 2001 19:33:38 -0000 1.2 +++ openacs-4/packages/ref-timezones/sql/oracle/ref-timezones-create.sql 16 Oct 2001 01:36:19 -0000 1.3 @@ -121,26 +121,15 @@ function utc_to_local ( -- Returns utc_time converted to local time - tz in timezones.tz%TYPE, + tz_id in timezones.tz_id%TYPE, utc_time in date ) return date; - function utc_to_local ( - -- Returns utc_time converted to local time - tz_id in timezones.tz_id%TYPE, - utc_time in date - ) return date; - function local_to_utc ( tz_id in timezones.tz_id%TYPE, local_time in date ) return date; - function local_to_utc ( - tz in timezones.tz%TYPE, - local_time in date - ) return date; - -- The following provide access to the current offset information function get_offset ( @@ -150,41 +139,23 @@ local_time in date default sysdate ) return integer; - function get_offset ( - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return integer; - - function get_rawoffset ( -- Gets the timezone offset NOT modified for DST tz_id in timezones.tz_id%TYPE, local_time in date default sysdate ) return integer; - function get_rawoffset ( - -- Gets the timezone offset NOT modified for DST - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return integer; - function get_abbrev ( -- Returns abbreviation for the coversion rule tz_id in timezones.tz_id%TYPE, local_time in date default sysdate ) return varchar; - function get_abbrev ( - -- Returns abbreviation for the coversion rule - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return varchar; - function get_zone_offset ( -- Returns the relative offset between two zones at a -- particular UTC time. - tz_this in timezones.tz%TYPE, - tz_other in timezones.tz%TYPE, + tz_this in timezones.tz_id%TYPE, + tz_other in timezones.tz_id%TYPE, utc_time in date default sysdate ) return integer; @@ -196,30 +167,16 @@ local_time in date default sysdate ) return char; - function isdst_p ( - -- Returns 't' if timezone is currently using DST - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return char; - - -- Special formatting functions function get_date ( -- Returns a formatted date with timezone info appended tz_id in timezones.tz_id%TYPE, local_time in date, - format in varchar default 'yyyy-mm-ss hh24:mi:ss' + format in varchar default 'yyyy-mm-ss hh24:mi:ss', + append_timezone_p in char default 't' ) return varchar; - function get_date ( - -- Returns a formatted date with timezone info appended - tz in timezones.tz%TYPE, - local_time in date, - format in varchar default 'yyyy-mm-ss hh24:mi:ss' - ) return varchar; - - end timezone; / show errors @@ -317,17 +274,6 @@ return utc_time; end utc_to_local; - function utc_to_local ( - tz in timezones.tz%TYPE, - utc_time in date - ) return date - is - begin - return utc_to_local(get_id(tz), utc_time); - end; - - - function local_to_utc ( tz_id in timezones.tz_id%TYPE, local_time in date @@ -347,15 +293,6 @@ return local_time; end; - function local_to_utc ( - tz in timezones.tz%TYPE, - local_time in date - ) return date - is - begin - return local_to_utc(get_id(tz),local_time); - end; - function get_offset ( tz_id in timezones.tz_id%TYPE, local_time in date default sysdate @@ -375,16 +312,6 @@ return 0; end; - function get_offset ( - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return integer - is - begin - return get_offset(get_id(tz),local_time); - end; - - function get_rawoffset ( tz_id in timezones.tz_id%TYPE, local_time in date default sysdate @@ -405,15 +332,6 @@ return 0; end; - function get_rawoffset ( - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return integer - is - begin - return get_rawoffset(get_id(tz),local_time); - end; - function get_abbrev ( tz_id in timezones.tz_id%TYPE, local_time in date default sysdate @@ -432,29 +350,26 @@ return 'GMT'; end; - function get_abbrev ( - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return varchar - is - begin - return get_abbrev(get_id(tz),local_time); - end; - function get_date ( -- Returns a formatted date with timezone info appended tz_id in timezones.tz_id%TYPE, local_time in date, - format in varchar default 'yyyy-mm-ss hh24:mi:ss' + format in varchar default 'yyyy-mm-ss hh24:mi:ss', + append_timezone_p in char default 't' ) return varchar is v_date varchar(1000); begin - select to_char(local_time,format) || ' ' || abbrev into v_date - from timezone_rules - where tz_id = get_date.tz_id - and local_time between local_start and local_end - and rownum = 1; + if append_timezone_p = 't' then + select to_char(local_time,format) || ' ' || abbrev into v_date + from timezone_rules + where tz_id = get_date.tz_id + and local_time between local_start and local_end + and rownum = 1; + else + select to_char(local_time,format) into v_date + from dual; + end if; return v_date; exception @@ -463,17 +378,6 @@ return v_date; end; - function get_date ( - tz in timezones.tz%TYPE, - local_time in date, - format in varchar default 'yyyy-mm-ss hh24:mi:ss' - ) return varchar - is - begin - return get_date(get_id(tz),local_time,format); - end; - - function isdst_p ( -- Returns 't' if timezone is currently using DST tz_id in timezones.tz_id%TYPE, @@ -494,18 +398,9 @@ return 'f'; end; - function isdst_p ( - tz in timezones.tz%TYPE, - local_time in date default sysdate - ) return char - is - begin - return isdst_p (get_id(tz),local_time); - end; - function get_zone_offset ( - tz_this in timezones.tz%TYPE, - tz_other in timezones.tz%TYPE, + tz_this in timezones.tz_id%TYPE, + tz_other in timezones.tz_id%TYPE, utc_time in date default sysdate ) return integer is