Subject Re: [firebird-support] Re: Hourly rate
Author Martijn Tonies
> > >TIME is not a cosmic static point!
> >
> > A TIME value represents a static point in a day (according to the
> 24-hour
> > clock convention observed by many mortals and computing devices on
> this
> > planet).
> Yup, meaning of static is depends on perspectif.
> It is static becouse the countries static.
> It is not static because, humans are portable with some objects.
> It is static because local users focused on local time.
> It is not static because there is Daylight savings and time tunings
> about world turning around speed lost.
> etc etc..

I fail to see what this has to do with the TIME datatype?

> > In Firebird, TIME is *stored* as a 32-bit unsigned integer (not
> BigInt),
> > representing the number of ten-thousandths of a second that have
> elapsed
> > since midnight. It will never be higher than 863,999,999 because
> it is
> > constrained to this limit. Internally, this number is handled as
> DECIMAL(9,4).
> I know this. it is what i said to Martijn.
> TIME is a numeric value >= 0 and <86400

TIME - the datatype - is NOT a numeric value, it's "time of day" as Helen
explained. How it is stored internally does not mean that "dividing" a TIME
will give you a TIME as a result, although you can assign the result to the
internal storage mechanism of TIME.

08:00 divided by 2 does not give you "time of day" 04:00 ... Yes, you can
assign it internally, on the low-level of "numeric value", but it's not

> How can you will calculate it without decimal value?
> Some digital systems can keep TIME parts in different registers.
> Time.Hours register between 0 and 23
> Time.Minutes Register between 0 and 59
> Time.Seconds Register between 0 and 59
> Time.Milliseconds Register between 0 999
> Milliseconds counter register feeding by freq. oscilator.
> when it become 1000, logic gates resets it to zero and
> adds 1 to Seconds,
> when seconds become 60, logic gates resets it to zero and
> adds 1 to minutes
> ...

All this has nothing to do with maths on TIME.

> Or there is only one big integer register counts oscilator signals.
> You can build TIME or TIMESTAMP from this number.
> It is not importand how you keep time numbers.
> But, if you want to some calculation with it you must to be obey
> math rules.

There are different rules. The concept of TIME is such that
TIME cannot be 25:00 ... I said this before and this still holds.

> > And the Firebird engine does its TIME and DATE computations in C
> in order
> > to store and retrieve date/time data. But data-users do their
> computations
> > in SQL. SQL uses symbols taken from English, but that does not
> mean that
> > SQL is semantically mapped to English. In English, if we want to
> know the
> > time-of-day, we ask "What is the TIME?" It is that gloss that SQL
> has
> > borrowed (and not "Can you estimate the TIME it will take?")
> >
> Helen it is not about English or any other language.
> It is about Logic, Digital technology depends on math and other
> sciences.
> We are lowest level computer users, if we don't intersted about
> technical calculation details, who will does it?
> Gates/Ellison/Dell/Honda..?
> Don't say me SQL is not related about
> logic or technology or programming knowladge.
> You can't be good RDBMS user without modern math and programming
> knowlange.(algorythm)
> > In Firebird, in SQL, you can add a numeric(9,4) number n
> (seconds) to a
> > TIME to get a result of TIME type that is that time-of-day + n
> seconds (or
> > an overflow), you can subtract n seconds to get a TIME type result
> (or an
> > underflow) and you can subtract one TIME type from another TIME
> type to get
> > a difference interval in seconds (or an underflow).
> >
> > >if you know a quick way about TIME,DATE,TIMESTAMP calculation,
> > >i will happy to learn it from you.
> >
> > To do what? In SQL you can "add" a DATE type to a TIME type to
> give a
> > TIMESTAMP result. Under the hood, this concatenates the DATE
> > representation (also a constrained 32-bit integer with a scale of
> 4) to the
> > TIME representation. However, since this is a concatenation
> operation
> > (appending time-of-day to a date-only value), you
> cannot "subtract" a TIME
> > from a TIMESTAMP to get a DATE type.
> >
> It is written as possible in my book.
> You can substract a time value from a timestamp and can assign
> result to a date datatype. They are numeric values and i can play
> with them what i want. I dont need any high level support.
> You know, there was no TIME datatype before IBv6.
> we keept times in smallint fields with check constraints.
> and there was no DATE only datatype also.
> we keept dates in smallint fields with...
> and there was no extract also...
> we calculted them ourself.

Oh brilliant. Then you should know that there's no concept of
"time" that holds 25 hours. That's a duration/interval etc...

The "check constraints" should tell you you're using a specific
domain for your internal values. A domain that makes sense
for your "time value".

But just because some operation (eg: dividing) results in a numerical
value that is inside your constraints does NOT mean it's a valid
result on the conceptual level.

> > You can add a number n to or subtract a number n from a DATE or
> > to advance or reduce the value by n days. The stored value of a
> DATE or
> > TIMESTAMP can be negative: this will happen for anything earlier
> than
> > November 17, 1898. In resolving these numbers, the engine counts
> backwards
> > until it hits the lower limit of numeric(9,4), which is some point
> in time
> > around AD 10, at which point (if it hasn't finished) it will throw
> an
> > underflow exception. That means Firebird can't store dates
> earlier than
> > that limit. (Task for you, Ali: compute Firebird's lowest and
> highest dates!)
> heh! you saying this to me Helen???
> Instead of Martijn or Arnoldo? LOL!

Now, I asked you before: if you think I'm wrong, then proof me wrong.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Upscene Productions
Database development questions? Check the forum!