dbTalk Databases Forums  

[Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970 in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970 - 07-19-2011 , 05:20 AM






Hi All,

It appears that the gmt_timestamp function (amongst others) can only handletimes after 1/1/1970. Furthermore, it can only take an integer4 input which makes the maximum date it can return to be 2038_01_19 03:14:07 GMT.

The attempt to use a integer8 input to gmt_timestamp fails:

select gmt_timestamp(int8(2147483648))\g
E_SC0206 An internal error prevents further processing of this query.
Associated error messages which provide more detailed information about
the problem can be found in the error log, II_CONFIG:errlog.log
And in the errlog we see:
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, adustring.c:3670 ]: Tue Jul 19 11:18:55 2011 E_AD9998_INTERNAL_ERROR AnADF internal coding error has been detected (cvgmt value overflow).
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, scsqncr.c:13891 ]: Tue Jul 19 11:18:55 2011 E_SC0216_QEF_ERROR Error returned by QEF.
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, scsqncr.c:13892 ]: Tue Jul 19 11:18:55 2011 E_SC0206_CANNOT_PROCESS Aninternal error prevents further processing of this query.
Associated error messages which provide more detailed information about theproblem can be found in the error log, II_CONFIG:errlog.log
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, scsqncr.c:13892 ]: PQuery: select gmt_timestamp(int8(2147483648))
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, scsqncr.c:13892 ]: Query: select gmt_timestamp(int8(2147483648)) ^@
BRAT_CTSU_OX_AC_UK::[52992 , 17100 , 00002aaacc7f6200, scsqncr.c:13892 ]: LQuery: set AUTOCOMMIT OFF^@

Also any negative input is treated (silently) as zero....
select gmt_timestamp(-1000)\g
Will return 1970_01_01 00:00:00 GMT

I need a function which can take int8 items both positive and negative and generate the appropriate date. Does anyone know of such a C function?

Marty

Reply With Quote
  #2  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970 - 07-19-2011 , 06:05 AM






Martin Bowes wrote:

Quote:
Hi All,

It appears that the gmt_timestamp function (amongst others) can only handle
times after 1/1/1970. Furthermore, it can only take an integer4 input
which makes the maximum date it can return to be 2038_01_19 03:14:07
GMT.
This is a well-known problem with a name:
http://en.wikipedia.org/wiki/Year_2038_problem

Quote:
The attempt to use a integer8 input to gmt_timestamp fails:
[snip]

Quote:
I need a function which can take int8 items both positive and negative
and generate the appropriate date. Does anyone know of such a C function?
Strangely, I think there is very little agreement and hence widely
adopted solution for this. I shall be interested to hear different.

--
Roy

UK Ingres User Association Conference 2012 will be on Tuesday June 19 2012.
*NOTE THE CHANGED DATE* See www.uk-iua.org.uk

Reply With Quote
  #3  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970 - 07-19-2011 , 06:42 AM



How about this:


Code:
--------------------
1> select date_gmt(date('01-jan-1970 00:00:00 GMT')+
date(varchar(int8(2147483648)/3600)+' hrs '+
varchar(mod(int8(2147483648),3600))+ ' sec'))



┌─────────────── ─────────┐
│col1 │
├─────────────── ─────────┤
│2038_01_19 03:14:08 GMT │
└─────────────── ─────────┘

2> select date_gmt(date('01-jan-1970 00:00:00 GMT')+
date(varchar(int8(-2147483648)/3600)+' hrs '+
varchar(mod(int8(-2147483648),3600))+ ' sec'))



┌─────────────── ─────────┐
│col1 │
├─────────────── ─────────┤
│1901_12_13 20:45:52 GMT │
└─────────────── ─────────┘
(1 row)
--------------------


--
Bodo

Reply With Quote
  #4  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038,before 1/1/1970 - 07-20-2011 , 03:52 AM



Hi Bodo,

Many thanks for that...seems to work like a dream!

Marty

-----Original Message-----
From: Ingres Forums [mailto:info-ingres (AT) kettleriverconsulting (DOT) com]
Sent: 19 July 2011 12:42
To: info-ingres (AT) kettleriverconsulting (DOT) com
Subject: Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970


How about this:


Code:
--------------------
1> select date_gmt(date('01-jan-1970 00:00:00 GMT')+
date(varchar(int8(2147483648)/3600)+' hrs '+
varchar(mod(int8(2147483648),3600))+ ' sec'))



┌─────────────── ─────────┐
│col1 │
├─────────────── ─────────┤
│2038_01_19 03:14:08 GMT │
└─────────────── ─────────┘

2> select date_gmt(date('01-jan-1970 00:00:00 GMT')+
date(varchar(int8(-2147483648)/3600)+' hrs '+
varchar(mod(int8(-2147483648),3600))+ ' sec'))



┌─────────────── ─────────┐
│col1 │
├─────────────── ─────────┤
│1901_12_13 20:45:52 GMT │
└─────────────── ─────────┘
(1 row)
--------------------


--
Bodo

Reply With Quote
  #5  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970 - 07-20-2011 , 05:10 AM



Martin Bowes;38284 Wrote:
Quote:
Hi Bodo,

Many thanks for that...seems to work like a dream!

Marty

Well, it's actually just a workaround.
It would be a dream if get_timestamp() wouldn't choke on it.
"internal coding error has been detected" says it all.
You should open a ServiceDesk issue for it.


--
Bodo

Reply With Quote
  #6  
Old   
Martin Bowes
 
Posts: n/a

Default Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038,before 1/1/1970 - 07-20-2011 , 05:52 AM



Hi Bodo,

Never fear! I raised it as a service desk query at the same time I put the original post on info_ingres.

Marty

-----Original Message-----
From: Ingres Forums [mailto:info-ingres (AT) kettleriverconsulting (DOT) com]
Sent: 20 July 2011 11:11
To: info-ingres (AT) kettleriverconsulting (DOT) com
Subject: Re: [Info-Ingres] gmt_timestamp() and dates beyond 2038, before 1/1/1970


Martin Bowes;38284 Wrote:
Quote:
Hi Bodo,

Many thanks for that...seems to work like a dream!

Marty

Well, it's actually just a workaround.
It would be a dream if get_timestamp() wouldn't choke on it.
"internal coding error has been detected" says it all.
You should open a ServiceDesk issue for it.


--
Bodo


_______________________________________________
Info-Ingres mailing list
Info-Ingres (AT) kettleriverconsulting (DOT) com
http://ext-cando.kettleriverconsulti...fo/info-ingres

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.