Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-12

NowUTC in the RTL

97 messages · 13 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

I would like to add NowUTC to SysUtils as we have already discussed previously. I think that the need for adding this should be of common knowledge for all after the long discussions about Now, and I understand that this was agreed upon, although surely we can discuss again.

So ok, now the problem starts. I have never added a new routine to the RTL before, so I am totally lost at what exactly to do, because there is a pletora of platforms there and I have implementations only for the platforms which I use, which are Windows and UNIX (I think it should work in all of them)

So what is done in these cases? Should I give some time for maintainers of those platforms to come up with implementations?

And if they don't? Just add a stub returning Now or something like that?

Adding a GetTickCount routine would also be good. Lazarus has this:

function GetTickCount64: QWord;

But maybe in the RTL it should have a different name to avoid conflicts with the Windows unit... but which name?

thanks,

Felipe Monteiro de Carvalho

Reply by email

zeljko
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 6 lines
Adding a GetTickCount routine would also be good. Lazarus has this: function GetTickCount64: QWord; But maybe in the RTL it should have a different name to avoid conflicts with the Windows unit... but which name?

fpGetTickCount, fpGetTickCount64 ?

zeljko

Reply by email

Tomas Hajny
to Felipe Monteiro de Carvalho: I would like to add NowUTC to SysUtils as we have already discussed previously. I think…

On Fri, December 9, 2011 09:23, Felipe Monteiro de Carvalho wrote:

Hi,

Show quoted text 16 lines
I would like to add NowUTC to SysUtils as we have already discussed previously. I think that the need for adding this should be of common knowledge for all after the long discussions about Now, and I understand that this was agreed upon, although surely we can discuss again. So ok, now the problem starts. I have never added a new routine to the RTL before, so I am totally lost at what exactly to do, because there is a pletora of platforms there and I have implementations only for the platforms which I use, which are Windows and UNIX (I think it should work in all of them) So what is done in these cases? Should I give some time for maintainers of those platforms to come up with implementations? And if they don't? Just add a stub returning Now or something like that?

Preferably add a common dummy version (based on Now as you suggested and possibly environment variable TZ because tools like Zip/Unzip provide this kind of user controlled support for timezone calculations even for platforms not providing such functionality at API level) for platforms without proper support (e.g. GO32v2) and include it under $IFNDEF HAS_UTCNOW which is then defined at the platform specific implementations. See sysutils.inc for existing examples.

Show quoted text 6 lines
Adding a GetTickCount routine would also be good. Lazarus has this: function GetTickCount64: QWord; But maybe in the RTL it should have a different name to avoid conflicts with the Windows unit... but which name?

Is it preferred to return ticks (dependent on various stuff), or something like GetMsCount (as already existing in unit Dos)?

Tomas

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho: I would like to add NowUTC to SysUtils as we have already discussed previously. I think…

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 5 lines
I would like to add NowUTC to SysUtils as we have already discussed previously. I think that the need for adding this should be of common knowledge for all after the long discussions about Now, and I understand that this was agreed upon, although surely we can discuss again.

I thought that discussion had established that a timezone based on fpgettimeofday is not reliable on Linux? Yet, I see it in this patch?

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort
Marco van de Voort wrote
I thought that discussion had established that a timezone based on fpgettimeofday is not reliable on Linux? Yet, I see it in this patch?

In my tests it worked. What do you propose instead?

Felipe Monteiro de Carvalho

Reply by email

Michael Van Canneyt
to Felipe Monteiro de Carvalho: I would like to add NowUTC to SysUtils as we have already discussed previously. I think…
Felipe Monteiro de Carvalho wrote 16 lines
Hello, I would like to add NowUTC to SysUtils as we have already discussed previously. I think that the need for adding this should be of common knowledge for all after the long discussions about Now, and I understand that this was agreed upon, although surely we can discuss again. So ok, now the problem starts. I have never added a new routine to the RTL before, so I am totally lost at what exactly to do, because there is a pletora of platforms there and I have implementations only for the platforms which I use, which are Windows and UNIX (I think it should work in all of them) So what is done in these cases? Should I give some time for maintainers of those platforms to come up with implementations?

There are 2 ways:
1. Place an empty routine in all platform sysutils units.

2. Placy a dummy routine which returns 'now' in sysutils.inc
{$IFNDEF FPC_HAS_NOWUTC}
function NowUTC : TDateTime;
begin
   Result:=Now;
end;
{$ENDIF}

Platform maintainers then add a {$DEFINE FPC_HAS_NOWUTC} to the platform unit as soon as they implement it, and their definition will be used instead.

Show quoted text 9 lines
And if they don't? Just add a stub returning Now or something like that? Adding a GetTickCount routine would also be good. Lazarus has this: function GetTickCount64: QWord; But maybe in the RTL it should have a different name to avoid conflicts with the Windows unit... but which name?

I don't think it needs a different name, GetTickCount is OK. Why would you need that ? Units are namespaces, after all.

Michael.

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho: In my tests it worked. What do you propose instead? Felipe Monteiro de Carvalho

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 5 lines
On Fri, Dec 9, 2011 at 10:39 AM, Marco van de Voort wrote: > I thought that discussion had established that a timezone based on > fpgettimeofday is not reliable on Linux? Yet, I see it in this patch? In my tests it worked. What do you propose instead?

Not adding routines to crossplatform interfaces till it is demonstrated it is properly implementable on all platforms. (or at least *nix, OSX and Windows, with *nix having some overlap with OS X)

Crossplatform functions which are only stubs on some platforms are useless and should not be added.

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 13 lines
In our previous episode, Felipe Monteiro de Carvalho said: > On Fri, Dec 9, 2011 at 10:39 AM, Marco van de Voort wrote: >> I thought that discussion had established that a timezone based on >> fpgettimeofday is not reliable on Linux? Yet, I see it in this patch? > > In my tests it worked. What do you propose instead? Not adding routines to crossplatform interfaces till it is demonstrated it is properly implementable on all platforms. (or at least *nix, OSX and Windows, with *nix having some overlap with OS X) Crossplatform functions which are only stubs on some platforms are useless and should not be added.

I don't see the problem.
As far as I can see, NowUTC should simply return the kernel time and not perform the shift to local time (which Now() should do).

Surely this works on all platforms ?

Michael.

Reply by email

Tomas Hajny
to Michael Van Canneyt
Michael Van Canneyt wrote 24 lines
On Fri, 9 Dec 2011, Marco van de Voort wrote: > In our previous episode, Felipe Monteiro de Carvalho said: >> On Fri, Dec 9, 2011 at 10:39 AM, Marco van de Voort >> wrote: >>> I thought that discussion had established that a timezone based on >>> fpgettimeofday is not reliable on Linux? Yet, I see it in this patch? >> >> In my tests it worked. What do you propose instead? > > Not adding routines to crossplatform interfaces till it is demonstrated > it > is properly implementable on all platforms. (or at least *nix, OSX and > Windows, with *nix having some overlap with OS X) > > Crossplatform functions which are only stubs on some platforms are > useless > and should not be added. I don't see the problem. As far as I can see, NowUTC should simply return the kernel time and not perform the shift to local time (which Now() should do). Surely this works on all platforms ?

.
.

...working with UTC natively. ;-)

Tomas

Reply by email

Marco van de Voort
to Michael Van Canneyt: I don't see the problem. As far as I can see, NowUTC should simply return the kernel time…

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
> Crossplatform functions which are only stubs on some platforms are useless > and should not be added. I don't see the problem. As far as I can see, NowUTC should simply return the kernel time and not perform the shift to local time (which Now() should do).

IIRC the discussion stated that maintaining timezones in the kernel on linux is deprecated?

Reply by email

Michael Van Canneyt
to Marco van de Voort
Marco van de Voort wrote 10 lines
In our previous episode, Michael Van Canneyt said: >> Crossplatform functions which are only stubs on some platforms are useless >> and should not be added. > > I don't see the problem. > As far as I can see, NowUTC should simply return the kernel time and not perform > the shift to local time (which Now() should do). IIRC the discussion stated that maintaining timezones in the kernel on linux is deprecated?

what does that have to do with the issue ?

The linux kernel returns UTC time, it always has. Now() converts this to local time. (as does libc). All NowUTC needs to do is return the kernel time.

Michael.

Reply by email

Jonas Maebe
to Michael Van Canneyt
Michael Van Canneyt wrote
The linux kernel returns UTC time, it always has. Now() converts this to local time. (as does libc). All NowUTC needs to do is return the kernel time.

It should only be called NowUTC if it is defined as always returning UTC on all platforms.

Jonas

Reply by email

Tomas Hajny
to Jonas Maebe
Jonas Maebe wrote 8 lines
On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: > The linux kernel returns UTC time, it always has. Now() converts > this to local time. > (as does libc). All NowUTC needs to do is return the kernel time. It should only be called NowUTC if it is defined as always returning UTC on all platforms.

Obviously assuming that something like that is possible on a certain platform at all (GO32v2 not having the TZ environment variable defined will simply never be able to provide UTC time; in fact, the same applies for OS/2 / eCS too).

Tomas

Reply by email

Felipe Monteiro de Carvalho
to Tomas Hajny: Preferably add a common dummy version (based on Now as you suggested and possibly…

2011/12/9 Tomas Hajny :

Is it preferred to return ticks (dependent on various stuff), or something like GetMsCount (as already existing in unit Dos)?

I would like to define it like this:

"FPGetTickCount returns the amount of ticks since an unspecified initial time. This initial time is unknown, but is fixed for the entire duration of the application. Ticks are time intervals and all of them have the same duration, but their exact meaning in terms of real world units like milliseconds is unspecified. FPGetTickCount is not affected by timezones and also not by the user changing the system clock."

So it matches Windows.GetTickCount well but still is flexible enough to be implemented in other platforms.

I don't think it needs a different name, GetTickCount is OK. Why would you need that ? Units are namespaces, after all.

Yes, but legacy applications with both SysUtils and Windows in the uses clause might suddently start using the SysUtils routine ... In Lazarus we tried something like that and we got a couple of problems very fast by units which suddenly started using the new GetTickCount ... it had to do with our GetTickCount returning 64-bits and the Windows one returning 32-bits... so that's why I would recommend FPGetTickCount: QWord

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Michael Van Canneyt: what does that have to do with the issue ? The linux kernel returns UTC time, it always…

In our previous episode, Michael Van Canneyt said:

Show quoted text 5 lines
what does that have to do with the issue ? The linux kernel returns UTC time, it always has. Now() converts this to local time. (as does libc). All NowUTC needs to do is return the kernel time.

Could be. I thought that was the old situation, but assumed now that timezone is an userland thing, it returned the HW clock. But I assume it needs some form of timezone too for certain protocols.

So who maintains the difference between hardware clock and UTC for the kernel's benefit then, and where is that maintained?

Reply by email

Michael Schnell
to Felipe Monteiro de Carvalho: 2011/12/9 Tomas Hajny : I would like to define it like this: "FPGetTickCount returns the…
Felipe Monteiro de Carvalho wrote 9 lines
I would like to define it like this: "FPGetTickCount returns the amount of ticks since an unspecified initial time. This initial time is unknown, but is fixed for the entire duration of the application. Ticks are time intervals and all of them have the same duration, but their exact meaning in terms of real world units like milliseconds is unspecified. FPGetTickCount is not affected by timezones and also not by the user changing the system clock." So it matches Windows.GetTickCount well but still is flexible enough to be implemented in other platforms.

What if the PC is polling a time server or similar ? IMHO FPGetTickCount should not be affected by such interference. This rules out using OS time API calls.

-Michael

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: Could be. I thought that was the old…
Marco van de Voort wrote 13 lines
In our previous episode, Michael Van Canneyt said: > > what does that have to do with the issue ? > > The linux kernel returns UTC time, it always has. Now() converts this to local time. > (as does libc). All NowUTC needs to do is return the kernel time. Could be. I thought that was the old situation, but assumed now that timezone is an userland thing, it returned the HW clock. But I assume it needs some form of timezone too for certain protocols. So who maintains the difference between hardware clock and UTC for the kernel's benefit then, and where is that maintained?

Userland (=libc) tools, hwclock and the like ?

Michael.

Reply by email

Michael Van Canneyt
to Jonas Maebe: It should only be called NowUTC if it is defined as always returning UTC on all platforms.
Jonas Maebe wrote 9 lines
On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: > The linux kernel returns UTC time, it always has. Now() converts this to > local time. > (as does libc). All NowUTC needs to do is return the kernel time. It should only be called NowUTC if it is defined as always returning UTC on all platforms.

Obviously :)

Michael.

Reply by email

Michael Van Canneyt
to Felipe Monteiro de Carvalho: 2011/12/9 Tomas Hajny : I would like to define it like this: "FPGetTickCount returns the…
Felipe Monteiro de Carvalho wrote 26 lines
2011/12/9 Tomas Hajny : > Is it preferred to return ticks (dependent on various stuff), or something > like GetMsCount (as already existing in unit Dos)? I would like to define it like this: "FPGetTickCount returns the amount of ticks since an unspecified initial time. This initial time is unknown, but is fixed for the entire duration of the application. Ticks are time intervals and all of them have the same duration, but their exact meaning in terms of real world units like milliseconds is unspecified. FPGetTickCount is not affected by timezones and also not by the user changing the system clock." So it matches Windows.GetTickCount well but still is flexible enough to be implemented in other platforms. > I don't think it needs a different name, GetTickCount is OK. Why would you need that ? Units are namespaces, after all. Yes, but legacy applications with both SysUtils and Windows in the uses clause might suddently start using the SysUtils routine ... In Lazarus we tried something like that and we got a couple of problems very fast by units which suddenly started using the new GetTickCount ... it had to do with our GetTickCount returning 64-bits and the Windows one returning 32-bits... so that's why I would recommend FPGetTickCount: QWord

OK.

Michael.

Reply by email

Michael Van Canneyt
to Tomas Hajny: Obviously assuming that something like that is possible on a certain platform at all…
Tomas Hajny wrote 14 lines
On Fri, December 9, 2011 13:07, Jonas Maebe wrote: > On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: > >> The linux kernel returns UTC time, it always has. Now() converts >> this to local time. >> (as does libc). All NowUTC needs to do is return the kernel time. > > It should only be called NowUTC if it is defined as always returning > UTC on all platforms. Obviously assuming that something like that is possible on a certain platform at all (GO32v2 not having the TZ environment variable defined will simply never be able to provide UTC time; in fact, the same applies for OS/2 / eCS too).

I do not think the Go32V2 environment needs to be considered. It stems from an age where the difference in timezones was irrelevant on a PC.

There are much more functions that perform strangely - if at all - in go32V2. It doesn't even have threading multi-tasking or multi-user support. Nonetheless we introduced already lots of functions that assume this, and no-one so much as squeaked then.
For a function as NowUTC I do not think we should start pulling this argument.

As far as I know, Windows and all Unix-like OSes support returning UTC. I know nothing about OS/2-eCS, but the same arguments as for Go32V2 apply as far as I am concerned. If all these platforms can guarantee returning correct UTC time, I do not see why we would not introduce it.

Michael.

Reply by email

Jonas Maebe
to Michael Van Canneyt
Michael Van Canneyt wrote
I know nothing about OS/2-eCS, but the same arguments as for Go32V2 apply as far as I am concerned. If all these platforms can guarantee returning correct UTC time, I do not see why we would not introduce it.

Afaik the original point was that some people were interested in some kind of timestamp that does not jump around (except possibly when overflowing). I don't think anyone particularly needed "the time in UTC". Therefore, something like FPGetTickCount seems much more appropriate than NowUTC, and it also solves the problem that some targets may not support returning the time in UTC.

Jonas

Reply by email

Marco van de Voort
to Jonas Maebe

In our previous episode, Jonas Maebe said:

Show quoted text 11 lines
> I know nothing about OS/2-eCS, but the same arguments as for Go32V2 > apply as far as I am concerned. If all these platforms can guarantee > returning correct UTC time, I do not see why we would not introduce > it. Afaik the original point was that some people were interested in some kind of timestamp that does not jump around (except possibly when overflowing). I don't think anyone particularly needed "the time in UTC". Therefore, something like FPGetTickCount seems much more appropriate than NowUTC, and it also solves the problem that some targets may not support returning the time in UTC.

Agree fully.

Reply by email

Marco van de Voort
to Michael Van Canneyt: Userland (=libc) tools, hwclock and the like ? Michael.

In our previous episode, Michael Van Canneyt said:

Show quoted text 8 lines
> Could be. I thought that was the old situation, but assumed now that > timezone is an userland thing, it returned the HW clock. But I assume it > needs some form of timezone too for certain protocols. > > So who maintains the difference between hardware clock and UTC for the > kernel's benefit then, and where is that maintained? Userland (=libc) tools, hwclock and the like ?

Any non-kernel solutions that might do own calculations yes.

Note that I'm asking because sooner or later I'll have to map whatever *nix implementation Felipe comes up with to FreeBSD.

Reply by email

Felipe Monteiro de Carvalho
to Jonas Maebe: Afaik the original point was that some people were interested in some kind of timestamp…
Jonas Maebe wrote
Afaik the original point was that some people were interested in some kind of timestamp that does not jump around (except possibly when overflowing). I don't think anyone particularly needed "the time in UTC".

I disagree. I think that getting the current time in UTC is basic enough to be awarded a routine and has merit on its own, even disregarding it's usage in profilers.

Not to mention that FPGetTickCount returns it's value in an unspecified time unit, what if I want a less disturbed time in miliseconds? A time which doesn't require reading a file to be obtained? (like the perfect Now() should do in UNIX )

something like FPGetTickCount seems much more appropriate than NowUTC, and

I think that they do not exclude one another.

it also solves the problem that some targets may not support returning the time in UTC.

I think that Michael already exposed more then enough the holes in this argument.

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho
On Fri, Dec 9, 2011 at 2:00 PM, Jonas Maebe wrote: > Afaik the original point was that some people were interested in some kind > of timestamp that does not jump around (except possibly when overflowing). I > don't think anyone particularly needed "the time in UTC".

Use case example: You need to store the current time in UTC in a database.

Felipe Monteiro de Carvalho

Reply by email

Felipe Monteiro de Carvalho
to Felipe Monteiro de Carvalho

aha, the implementation of NowUTC is a bit more complex then I thought =D

I tested it in Mac OS X and in a linux in a virtual machine and it worked perfectly, but now I tested in a linux machine and it failed ... and I just found that in my system I have:

/etc/sysconfig/clock

UTC=false <-- problem here
ARC=false
ZONE=Poland

So NowUTC is not really necessarily immune to the lookup of files in Linux.

But I still maintain that it is a very useful routine.

Felipe Monteiro de Carvalho

Reply by email

Hans-Peter Diettrich
to Michael Van Canneyt: There are 2 ways: 1. Place an empty routine in all platform sysutils units. 2. Placy a…
Show quoted text 8 lines
2. Placy a dummy routine which returns 'now' in sysutils.inc {$IFNDEF FPC_HAS_NOWUTC} function NowUTC : TDateTime; begin Result:=Now; end; {$ENDIF}

IMO the dummy routine should return some error value, e.g. zero or NaN, that makes it clear to the user that something's wrong with that function. Else nobody will ever notice and update the implementation.

DoDi

Reply by email

Sven Barth
to Michael Schnell: What if the PC is polling a time server or similar ? IMHO FPGetTickCount should not be…
Michael Schnell wrote 14 lines
On 12/09/2011 01:17 PM, Felipe Monteiro de Carvalho wrote: > I would like to define it like this: "FPGetTickCount returns the > amount of ticks since an unspecified initial time. This initial time > is unknown, but is fixed for the entire duration of the application. > Ticks are time intervals and all of them have the same duration, but > their exact meaning in terms of real world units like milliseconds is > unspecified. FPGetTickCount is not affected by timezones and also not > by the user changing the system clock." So it matches > Windows.GetTickCount well but still is flexible enough to be > implemented in other platforms. What if the PC is polling a time server or similar ? IMHO FPGetTickCount should not be affected by such interference. This rules out using OS time API calls.

The description of Felipe mathes Windows' GetTickCount (number of milliseconds since system start) and Linux' MONOTONIC_RAW time (or however it is called exactly). So I don't see why this should rule out OS time API calls...

Regards,
Sven

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho: Use case example: You need to store the current time in UTC in a database. Felipe…

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 6 lines
> On Fri, Dec 9, 2011 at 2:00 PM, Jonas Maebe wrote: >> Afaik the original point was that some people were interested in some kind >> of timestamp that does not jump around (except possibly when overflowing). I >> don't think anyone particularly needed "the time in UTC". Use case example: You need to store the current time in UTC in a database.

Nine times out of ten you solve that server side, not client side.

Reply by email

Marco van de Voort
to Michael Van Canneyt: I have this on my todo list. The main problem is that I don't know yet if it is…

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
> for it ... I have this on my todo list. The main problem is that I don't know yet if it is Linux-specific or Posix. That will determine which unit it will be added to. Maybe Marco knows more ?

No idea.

But maybe IMHO this kind of stuff should remain out of sysutils, certainly now it is not entirely clear, and people are still searching for solutions.

Sysutils should only contain stuff that is absolutely certain to be portable.

And if it is outside of sysutils, it can also link to libc on *nix.

So IMHO, stuff it in fcl-base as "timerutils" or so, let it link to libc, basta. I don't see the need for it in the core subset, and neither the need to do it all manually.

Reply by email

Felipe Monteiro de Carvalho
to Michael Van Canneyt: I have this on my todo list. The main problem is that I don't know yet if it is…
Michael Van Canneyt wrote
The main problem is that I don't know yet if it is Linux-specific or Posix. That will determine which unit it will be added to. Maybe Marco knows more ?

Wow, timing in UNIX is such a mess, it seams that clock_gettime doesn't exist in Mac OS X =(

http://juliusdavies.ca/posix_clocks/clock_realtime_macosx_faq.html

http://www.tin.org/bin/man.cgi?section=3&topic=clock_gettime

AVAILABILITY
On POSIX systems on which these functions are available, the symbol _POSIX_TIMERS is defined in <unistd.h> to a value greater than 0. The symbols _POSIX_MONOTONIC_CLOCK, _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME indicate that CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID are available. (See also sysconf(3).)

But it exists in FreeBSD:

http://www.unix.com/man-page/FreeBSD/2/CLOCK_GETTIME/

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho: aha, the implementation of NowUTC is a bit more complex then I thought =D I tested it in…

In our previous episode, Felipe Monteiro de Carvalho said: [ Charset ISO-8859-1 unsupported, converting... ]

Show quoted text 11 lines
aha, the implementation of NowUTC is a bit more complex then I thought =D I tested it in Mac OS X and in a linux in a virtual machine and it worked perfectly, but now I tested in a linux machine and it failed ... and I just found that in my system I have: /etc/sysconfig/clock UTC=false <-- problem here ARC=false ZONE=Poland

Here (FC14) contains:

# The time zone of the system is defined by the contents of /etc/localtime. # This file is only for evaluation by system-config-date, do not rely on its # contents elsewhere.
ZONE="Europe/Amsterdam"

and /etc/localtime is binary

So be very careful extrapolating "a" linux distro to "linux".

And FreeBSD doesn't have /etc/sysconfig at all.

Reply by email

Jonas Maebe
to Felipe Monteiro de Carvalho: I disagree. I think that getting the current time in UTC is basic enough to be awarded a…
Felipe Monteiro de Carvalho wrote 11 lines
On Fri, Dec 9, 2011 at 2:00 PM, Jonas Maebe wrote: > Afaik the original point was that some people were interested in > some kind > of timestamp that does not jump around (except possibly when > overflowing). I > don't think anyone particularly needed "the time in UTC". I disagree. I think that getting the current time in UTC is basic enough to be awarded a routine and has merit on its own, even disregarding it's usage in profilers.

Possibly, but that's a different discussion than the one you referred to in your original mail.

Show quoted text 6 lines
> it also solves the problem that some targets may not support > returning the > time in UTC. I think that Michael already exposed more then enough the holes in this argument.

He did not expose any holes in any argument. He simply said that Go32v2 and OS/2 can be ignored as far as any potential implementation problems are concerned because Go32v2 and to a (much) lesser extent OS/ 2 do not support various features. I strongly disagree about the OS/2 part because its target support is still actively maintained, so the least courtesy we can do is to try to accomodate it rather than simply upfront state "if it doesn't work for your target, tough luck".

Jonas

Reply by email

Henry Vermaak
to Michael Van Canneyt: I have this on my todo list. The main problem is that I don't know yet if it is…
Michael Van Canneyt wrote 14 lines
On Fri, 9 Dec 2011, Felipe Monteiro de Carvalho wrote: > Hello, > > How can one call clock_gettime ? I couldn't find a fp prefixed routine > for it ... I have this on my todo list. The main problem is that I don't know yet if it is Linux-specific or Posix. That will determine which unit it will be added to. Maybe Marco knows more ?

The man page says it's POSIX:

http://www.kernel.org/doc/man-pages/online/pages/man2/clock_gettime.2.html#CONFORMING_TO

Henry

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: No idea. But maybe IMHO this kind of…
Marco van de Voort wrote 12 lines
In our previous episode, Michael Van Canneyt said: >> for it ... > > I have this on my todo list. > > The main problem is that I don't know yet if it is Linux-specific or Posix. > That will determine which unit it will be added to. Maybe Marco knows more ? No idea. But maybe IMHO this kind of stuff should remain out of sysutils, certainly now it is not entirely clear, and people are still searching for solutions.

That's not the question.

clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils.

The question is whether clock_gettime is POSIX, and if BSD has it. The linux man page seems to say it is POSIX 2001. My question is if BSD has it.

If so, it can be added to baseunix/unix, instead of linux.

Michael.

Reply by email

Michael Schnell
to Sven Barth: The description of Felipe mathes Windows' GetTickCount (number of milliseconds since…
Sven Barth wrote 5 lines
The description of Felipe mathes Windows' GetTickCount (number of milliseconds since system start) and Linux' MONOTONIC_RAW time (or however it is called exactly). So I don't see why this should rule out OS time API calls...

He writes: " Ticks are time intervals and all of them have the same duration "

So the counting is not allowed to stop or to jump forward in case a time server access by daemon changing the system time is not allowed to interfere in any way.

So I suppose "GetTickCount (number of milliseconds since system start)" would be OK, but MONOTONIC_RAW time does not _sound_ correct.

On Linux, "get_jiffies_64()" seems to be a decent Kernel call.

-Michael

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: No idea. But maybe IMHO this kind of…
Marco van de Voort wrote
But maybe IMHO this kind of stuff should remain out of sysutils, certainly now it is not entirely clear, and people are still searching for solutions.

NowUTC is not any less portable then Now in relevant platforms.

My question about clock_gettime was for FPGetTickCount, which indeed is still far from having a proper implementation.

So IMHO, stuff it in fcl-base as "timerutils" or so, let it link to libc, basta. I don't see the need for it in the core subset, and neither the need to do it all manually.

This would be useless, both NowUTC and GetTickCount64 are already in lazutils, so I don't see any benefit in moving them to anything in the FCL.

But I saw a benefit in moving NowUTC to the RTL because it shares a lot of code with Now, they are nearly identical, so we could avoid duplicated code and because it is a very basic routine.

Felipe Monteiro de Carvalho

Reply by email

Helmut Hartl
to Michael Van Canneyt: That's not the question. clock_gettime is a linux kernel call. No-one is proposing to add…
Michael Van Canneyt wrote 11 lines
That's not the question. clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils. The question is whether clock_gettime is POSIX, and if BSD has it. The linux man page seems to say it is POSIX 2001. My question is if BSD has it. If so, it can be added to baseunix/unix, instead of linux.

it is - i am using it since years ...

http://www.freebsd.org/cgi/man.cgi?query=clock_gettime

helmut

Reply by email

zeljko
to Sven Barth: The description of Felipe mathes Windows' GetTickCount (number of milliseconds since…
Sven Barth wrote 20 lines
Am 09.12.2011 13:30, schrieb Michael Schnell: > On 12/09/2011 01:17 PM, Felipe Monteiro de Carvalho wrote: >> I would like to define it like this: "FPGetTickCount returns the >> amount of ticks since an unspecified initial time. This initial time >> is unknown, but is fixed for the entire duration of the application. >> Ticks are time intervals and all of them have the same duration, but >> their exact meaning in terms of real world units like milliseconds is >> unspecified. FPGetTickCount is not affected by timezones and also not >> by the user changing the system clock." So it matches >> Windows.GetTickCount well but still is flexible enough to be >> implemented in other platforms. > > What if the PC is polling a time server or similar ? IMHO FPGetTickCount > should not be affected by such interference. This rules out using OS > time API calls. The description of Felipe mathes Windows' GetTickCount (number of milliseconds since system start) and Linux' MONOTONIC_RAW time (or however it is called exactly). So I don't see why this should rule out OS time API calls...

No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on older kernels.

zeljko

Reply by email

Felipe Monteiro de Carvalho
to zeljko
zeljko wrote
No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on older kernels.

My ideas was: Check if MONOTONIC_RAW is available, if yes, use it, if not, fallback to MONOTONIC which is a close approximation, not perfect, but the best one can do for old kernels.

Felipe Monteiro de Carvalho

Reply by email

Hans-Peter Diettrich
to Jonas Maebe: Afaik the original point was that some people were interested in some kind of timestamp…
Show quoted text 10 lines
On 09 Dec 2011, at 13:47, Michael Van Canneyt wrote: > I know nothing about OS/2-eCS, but the same arguments as for Go32V2 > apply as far as I am concerned. If all these platforms can guarantee > returning correct UTC time, I do not see why we would not introduce it. Afaik the original point was that some people were interested in some kind of timestamp that does not jump around (except possibly when overflowing).

I.e. means to quickly build time *differences*, for performance and progress display. That's almost the only use for GetTickCount, and for that purpose the underlying source must be monotonic.

I don't think anyone particularly needed "the time in UTC". Therefore, something like FPGetTickCount seems much more appropriate than NowUTC, and it also solves the problem that some targets may not support returning the time in UTC.

In contrast to Now with local time (with DST and timezones), NowUTC should return monotonic, platform independent and comparable absolute time values.

When some (very old) platforms don't support UTC, we could at least implement something like GetTimeStamp, that returns absolute time values at least for the current platform. These values should be usable as unique (monontonic) time stamps in e.g. log files.

DoDi

Reply by email

Marco van de Voort
to Michael Van Canneyt: That's not the question. clock_gettime is a linux kernel call. No-one is proposing to add…

In our previous episode, Michael Van Canneyt said:

Show quoted text 7 lines
> > But maybe IMHO this kind of stuff should remain out of sysutils, certainly now > it is not entirely clear, and people are still searching for solutions. That's not the question. clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils.

If we decide to use it via libc, we might not have to add it as a syscall.

The question is whether clock_gettime is POSIX, and if BSD has it. The linux man page seems to say it is POSIX 2001. My question is if BSD has it.

FreeBSD has it. But OS X hasn't it seems, not even in recent versions.

Solaris seems to have it (libc call (3) though).
Can't check openbsd or Haiku easily.

Reply by email

Felipe Monteiro de Carvalho
to Jonas Maebe: Possibly, but that's a different discussion than the one you referred to in your original…
Jonas Maebe wrote 7 lines
He did not expose any holes in any argument. He simply said that Go32v2 and OS/2 can be ignored as far as any potential implementation problems are concerned because Go32v2 and to a (much) lesser extent OS/2 do not support various features. I strongly disagree about the OS/2 part because its target support is still actively maintained, so the least courtesy we can do is to try to accomodate it rather than simply upfront state "if it doesn't work for your target, tough luck".

I don't see any loss of the OS/2 FPC community if 1 routine won't work for them, supposing it is really impossible to implement it there.

Will things be better for the OS/2 FPC community if instead of only OS/2 not having NowUTC noone has?

And to put things into their real perspective, what is the proportion of OS/2 users in the FPC community? From source forge I'd say 0,005% or less

Felipe Monteiro de Carvalho

Reply by email

Tomas Hajny
to Felipe Monteiro de Carvalho: 2011/12/9 Tomas Hajny : I would like to define it like this: "FPGetTickCount returns the…
Felipe Monteiro de Carvalho wrote 17 lines
2011/12/9 Tomas Hajny : > Is it preferred to return ticks (dependent on various stuff), or > something > like GetMsCount (as already existing in unit Dos)? I would like to define it like this: "FPGetTickCount returns the amount of ticks since an unspecified initial time. This initial time is unknown, but is fixed for the entire duration of the application. Ticks are time intervals and all of them have the same duration, but their exact meaning in terms of real world units like milliseconds is unspecified. FPGetTickCount is not affected by timezones and also not by the user changing the system clock." So it matches Windows.GetTickCount well but still is flexible enough to be implemented in other platforms.

.
.

Is this "time fixed for the entire duration of the application" available on all platforms (especially considering the HW point of view now)?

Wouldn't the use be limited by the fact that the length of time is not specified at all? You cannot use it for measuring of time intervals any longer then, e.g. stuff like check if the period of time between two events was at least X (that was the reason for implementing Dos.GetMsCount some time ago) or measuring that certain procedure took Y. There's also a risk that users will start using it that way anyway based on assumptions from x86 is probably the worst thing resulting in unportable code.

Tomas

Reply by email

Marco van de Voort
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: If we decide to use it via libc, we…

In our previous episode, Marco van de Voort said:

Show quoted text 15 lines
In our previous episode, Michael Van Canneyt said: > > > > But maybe IMHO this kind of stuff should remain out of sysutils, certainly now > > it is not entirely clear, and people are still searching for solutions. > > That's not the question. > > clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils. If we decide to use it via libc, we might not have to add it as a syscall. > The question is whether clock_gettime is POSIX, and if BSD has it. > The linux man page seems to say it is POSIX 2001. My question is if BSD has it. FreeBSD has it. But OS X hasn't it seems, not even in recent versions.

Let's not forget btw that it is not just a matter of the call, the constants matter too.

E.g. constants for FreeBSD: (even with clock_gettime, it is not guaranteed that all clock varieties are supported. Can't get that from the manpages).

So while monotonic exists, it seems to be in seconds. Maybe the precise/fast freebsd specific ones have low granularity.

From manpage:

The clock_id argument can be one of five values: CLOCK_REALTIME for time that increments as a wall clock should, CLOCK_MONOTONIC which increments
in SI seconds, CLOCK_UPTIME which starts at zero when the kernel boots and increments monotonically in SI seconds while the machine is running,
CLOCK_VIRTUAL for time that increments only when the CPU is running in user mode on behalf of the calling process, or CLOCK_PROF for time that increments when the CPU is running in user or kernel mode.

and header:

#define CLOCK_REALTIME 0
#ifdef __BSD_VISIBLE
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
#endif
#define CLOCK_MONOTONIC 4
#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ #define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ #define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ #define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ #define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ #define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ #define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ #define CLOCK_SECOND 13 /* FreeBSD-specific. */ #define CLOCK_THREAD_CPUTIME_ID 14
#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */

Reply by email

Tomas Hajny
to Michael Van Canneyt: I do not think the Go32V2 environment needs to be considered. It stems from an age where…
Michael Van Canneyt wrote 32 lines
On Fri, 9 Dec 2011, Tomas Hajny wrote: > On Fri, December 9, 2011 13:07, Jonas Maebe wrote: >> On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: >> >>> The linux kernel returns UTC time, it always has. Now() converts >>> this to local time. >>> (as does libc). All NowUTC needs to do is return the kernel time. >> >> It should only be called NowUTC if it is defined as always returning >> UTC on all platforms. > > Obviously assuming that something like that is possible on a certain > platform at all (GO32v2 not having the TZ environment variable defined > will simply never be able to provide UTC time; in fact, the same applies > for OS/2 / eCS too). I do not think the Go32V2 environment needs to be considered. It stems from an age where the difference in timezones was irrelevant on a PC. There are much more functions that perform strangely - if at all - in go32V2. It doesn't even have threading multi-tasking or multi-user support. Nonetheless we introduced already lots of functions that assume this, and no-one so much as squeaked then. For a function as NowUTC I do not think we should start pulling this argument. As far as I know, Windows and all Unix-like OSes support returning UTC. I know nothing about OS/2-eCS, but the same arguments as for Go32V2 apply as far as I am concerned. If all these platforms can guarantee returning correct UTC time, I do not see why we would not introduce it.

That was not meant as argument against introducing NowUTC, but rather just a comment that your stated goal of providing UTC everywhere may not be met. I don't have any objections.

Tomas

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Marco van de Voort said: Let's not forget btw that it is not…
Marco van de Voort wrote 11 lines
In our previous episode, Marco van de Voort said: > In our previous episode, Michael Van Canneyt said: >>> >>> But maybe IMHO this kind of stuff should remain out of sysutils, certainly now >>> it is not entirely clear, and people are still searching for solutions. >> >> That's not the question. >> >> clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils. > > If we decide to use it via libc, we might not have to add it as a syscall.

That sounds as if you think a syscall is a bad thing ? In each case, it's not really relevant.

Show quoted text 8 lines
> >> The question is whether clock_gettime is POSIX, and if BSD has it. >> The linux man page seems to say it is POSIX 2001. My question is if BSD has it. > > FreeBSD has it. But OS X hasn't it seems, not even in recent versions. Let's not forget btw that it is not just a matter of the call, the constants matter too.
This is not a real argument;
The constants or types for many other posixy-functions are system dependent;
we introduced them anyway.

Well, if OS-X does not have it, we can't really say it is POSIX for our purposes, so then it goes to the linux unit. It's as simple as that.

Unless you have arguments for putting it in (base)unix anyway.

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Tomas Hajny: . . Is this "time fixed for the entire duration of the application" available on all…

2011/12/9 Tomas Hajny :

Wouldn't the use be limited by the fact that the length of time is not specified at all?

Yes, this limits the usefulness of the routine. I added it to simplify the implementation and match Windows.GetTickCount64 and MONOTONIC_RAW, but if someone can come up with a better implementation which supports a specified length of time it would be ideal.

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Michael Van Canneyt: That sounds as if you think a syscall is a bad thing ? In each case, it's not really…

In our previous episode, Michael Van Canneyt said:

Show quoted text 5 lines
>>> clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils. >> >> If we decide to use it via libc, we might not have to add it as a syscall. That sounds as if you think a syscall is a bad thing ?

For borderline functionality ? yes I do.

It is something else to avoid the core system getting to entangled with libc, but that doesn't mean I want to reimplement all libc of all unixy platforms and maintain that.

If it is not necessary, IMHO we shouldn't add it to core units. Including baseunix.

Show quoted text 6 lines
> Let's not forget btw that it is not just a matter of the call, the constants > matter too. This is not a real argument; The constants or types for many other posixy-functions are system dependent; we introduced them anyway.

The problem is that you don't want clock_gettime(), but clock_gettime(MONOTONIC_RAW).

The constant is not something where you merely have to search the relevant values for the various OS, and have one or two that are unsupported, but the core reason to add it is not portable. At least if I understood everything correctly.

There is a fat chance that the whole finely grained monotonic stuff is highly OS specific. But maybe Helmut can weigh in on that again.

Well, if OS-X does not have it, we can't really say it is POSIX for our purposes, so then it goes to the linux unit. It's as simple as that. Unless you have arguments for putting it in (base)unix anyway.

No. Better put it in target specific units, so that people know they are messing with functions with portability issues.

Reply by email

Michael Van Canneyt
to Jonas Maebe: Possibly, but that's a different discussion than the one you referred to in your original…
Jonas Maebe wrote 13 lines
>> it also solves the problem that some targets may not support returning the >> time in UTC. > > I think that Michael already exposed more then enough the holes in > this argument. He did not expose any holes in any argument. He simply said that Go32v2 and OS/2 can be ignored as far as any potential implementation problems are concerned because Go32v2 and to a (much) lesser extent OS/2 do not support various features. I strongly disagree about the OS/2 part because its target support is still actively maintained, so the least courtesy we can do is to try to accomodate it rather than simply upfront state "if it doesn't work for your target, tough luck".

Hola :-) I didn't say we should not accomodate it.

I did say that *the decision* to introduce it should not depend on some specific older platforms not being able to support it, since this is true for other calls as well, and they were introduced nonetheless.

If we decide to put it in, we should help Tomas finding an implementation method for OS/2. This is understood.

Michael.

Reply by email

Helmut Hartl
to Michael Van Canneyt: That sounds as if you think a syscall is a bad thing ? In each case, it's not really…
Well, if OS-X does not have it, we can't really say it is POSIX for our purposes, so then it goes to the linux unit. It's as simple as that.

Only if you discriminate BSD systems :-) - Many professional vendors use some sort of BSD in their products,
and some fpc.

Freebsd, Netbsd, Openbsd, and Linux has it.
For OSX there is a substitution:
http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x

helmut

Reply by email

Sven Barth
to Hans-Peter Diettrich: IMO the dummy routine should return some error value, e.g. zero or NaN, that makes it…
Hans-Peter Diettrich wrote 14 lines
Michael Van Canneyt schrieb: > 2. Placy a dummy routine which returns 'now' in sysutils.inc > {$IFNDEF FPC_HAS_NOWUTC} > function NowUTC : TDateTime; > > begin > Result:=Now; > end; > {$ENDIF} IMO the dummy routine should return some error value, e.g. zero or NaN, that makes it clear to the user that something's wrong with that function. Else nobody will ever notice and update the implementation.

No, this is common practice in the RTL so there's no need to change that.

Regards,
Sven

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: For borderline functionality ? yes I…
Marco van de Voort wrote 7 lines
> Well, if OS-X does not have it, we can't really say it is POSIX for our purposes, > so then it goes to the linux unit. It's as simple as that. > > Unless you have arguments for putting it in (base)unix anyway. No. Better put it in target specific units, so that people know they are messing with functions with portability issues.

No problem.
I will do it so, I was leaning to this anyway based on the mails of Zeljko some weeks back where the OSX issue was already touched upon.

I just wanted to know the POSIX situation first, and now that's cleared up.

Michael.

Reply by email

Sven Barth
to zeljko: No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on older kernels. zeljko
zeljko wrote 46 lines
On Friday 09 of December 2011 14:52:56 Sven Barth wrote: > Am 09.12.2011 13:30, schrieb Michael Schnell: > > On 12/09/2011 01:17 PM, Felipe Monteiro de Carvalho wrote: > >> I would like to define it like this: "FPGetTickCount returns the > >> amount of ticks since an unspecified initial time. This initial time > >> is unknown, but is fixed for the entire duration of the application. > >> Ticks are time intervals and all of them have the same duration, but > >> their exact meaning in terms of real world units like milliseconds is > >> unspecified. FPGetTickCount is not affected by timezones and also not > >> by the user changing the system clock." So it matches > >> Windows.GetTickCount well but still is flexible enough to be > >> implemented in other platforms. > > > > What if the PC is polling a time server or similar ? IMHO FPGetTickCount > > should not be affected by such interference. This rules out using OS > > time API calls. > > The description of Felipe mathes Windows' GetTickCount (number of > milliseconds since system start) and Linux' MONOTONIC_RAW time (or > however it is called exactly). So I don't see why this should rule out > OS time API calls... No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on older kernels.

My comment was less for which timer type we should support, but more to have a argument for what Felipe said.

Regards,
Sven

Reply by email

Sven Barth
to Michael Schnell: He writes: " Ticks are time intervals and all of them have the same duration " So the…
Michael Schnell wrote 16 lines
On 12/09/2011 02:52 PM, Sven Barth wrote: > > The description of Felipe mathes Windows' GetTickCount (number of > milliseconds since system start) and Linux' MONOTONIC_RAW time (or > however it is called exactly). So I don't see why this should rule out > OS time API calls... He writes: " Ticks are time intervals and all of them have the same duration " So the counting is not allowed to stop or to jump forward in case a time server access by daemon changing the system time is not allowed to interfere in any way. So I suppose "GetTickCount (number of milliseconds since system start)" would be OK, but MONOTONIC_RAW time does not _sound_ correct.

I haven't found an entry for "MONOTONIC_RAW" (my system's manpage has one, but I'm currently at work), but for MONOTONIC:

CLOCK_MONOTONIC
Clock that cannot be set and represents monotonic time since some unspecified starting point.

So even if a deamon plays around with the time the MONOTONIC clock should not be affected. That's the basic idea of the MONOTONIC clocks.

On Linux, "get_jiffies_64()" seems to be a decent Kernel call.

I don't know that, so I can't comment here.

Regards,
Sven

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: For borderline functionality ? yes I…
Marco van de Voort wrote
It is something else to avoid the core system getting to entangled with libc, but that doesn't mean I want to reimplement all libc of all unixy platforms and maintain that.

Why do we provide our own memory manager anyway? Just kill it and ship cmem only.

fcl-image? kill it in favor of the bindings to ImageMagick.

WriteLn? The platform probably already has printf...

The problem is that you don't want clock_gettime(), but clock_gettime(MONOTONIC_RAW).

Not true, I would like to have the general routine. At least CLOCK_MONOTONIC_RAW, CLOCK_MONOTINIC and CLOCK_REALTIME are constants I already know I'd like to test. But there may be more.

Felipe Monteiro de Carvalho

Reply by email

Sven Barth
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 11 lines
On Fri, Dec 9, 2011 at 4:04 PM, Marco van de Voort wrote: > It is something else to avoid the core system getting to entangled with > libc, but that doesn't mean I want to reimplement all libc of all unixy > platforms and maintain that. Why do we provide our own memory manager anyway? Just kill it and ship cmem only. fcl-image? kill it in favor of the bindings to ImageMagick. WriteLn? The platform probably already has printf...

Your statements (except the fcl-image one) contradict Marco's statement "to avoid the core system getting to entangled with libc".

Regards,
Sven

Reply by email

Marco van de Voort
to Michael Van Canneyt: No problem. I will do it so, I was leaning to this anyway based on the mails of Zeljko…

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
No problem. I will do it so, I was leaning to this anyway based on the mails of Zeljko some weeks back where the OSX issue was already touched upon. I just wanted to know the POSIX situation first, and now that's cleared up.

Btw, you'll need clock_getres too, to get the granularity of the relevant timer. (and anything using these, should really use that function)

Still I think it is better to put this in a package, and link to libc for them, instead of pulling this into the core. (iow, like the users package)

Reply by email

Michael Van Canneyt
to Helmut Hartl: Only if you discriminate BSD systems :-) - Many professional vendors use some sort of…
Helmut Hartl wrote 11 lines
> Well, if OS-X does not have it, we can't really say it is POSIX for our > purposes, so then it goes to the linux unit. It's as simple as that. > Only if you discriminate BSD systems :-) - Many professional vendors use some sort of BSD in their products, and some fpc. Freebsd, Netbsd, Openbsd, and Linux has it. For OSX there is a substitution: http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x

Well, you'll have to convince Marco.
But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :)

But till you do convince him, I'll put it in the linux unit, and Marco can put it in a *BSD specific unit.

That's what these units are for.

Michael.

Reply by email

Marco van de Voort
to Felipe Monteiro de Carvalho: Why do we provide our own memory manager anyway? Just kill it and ship cmem only.…

In our previous episode, Felipe Monteiro de Carvalho said:

Show quoted text 5 lines
> It is something else to avoid the core system getting to entangled with > libc, but that doesn't mean I want to reimplement all libc of all unixy > platforms and maintain that. Why do we provide our own memory manager anyway?

Because any program needs a memory manager, and we decided that the core RTL should run without libc. (and I still stand by that decision then, and I'm open to discussion wrt the current situation)

Just kill it and ship cmem only.

No need to apply reductio ad absurdum. There are already precedents enough, like users, cnetdb and all other C lib headers in pacakges/

Show quoted text 5 lines
> The problem is that you don't want clock_gettime(), > but clock_gettime(MONOTONIC_RAW). Not true, I would like to have the general routine. At least CLOCK_MONOTONIC_RAW, CLOCK_MONOTINIC and CLOCK_REALTIME are constants

No. Monotonic_RAW is linux specific, and maybe not even on all archs.

And while the other two exist more widely, there are warnings about granularity and not assuming anything about their granularity (which might be one full second)

I already know I'd like to test. But there may be more.

IMHO that should have been done in the first place. First research and find a workable, portable way, and only then put it up for inclusion.

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: Btw, you'll need clock_getres too, to…
Marco van de Voort wrote 13 lines
In our previous episode, Michael Van Canneyt said: > > No problem. > I will do it so, I was leaning to this anyway based on the mails of Zeljko some > weeks back where the OSX issue was already touched upon. > > I just wanted to know the POSIX situation first, and now that's cleared up. Btw, you'll need clock_getres too, to get the granularity of the relevant timer. (and anything using these, should really use that function) Still I think it is better to put this in a package, and link to libc for them, instead of pulling this into the core. (iow, like the users package)

No, that's what the Linux unit is for: provide access to linux kernel calls not specified in POSIX. Linking to libc is not an option, I leave that to the (hereto imaginary) implementors of a glibc() unit.

I plan to add inotify() calls there as well (in separate commits, though).

Michael.

Reply by email

Henry Vermaak
to Michael Schnell: He writes: " Ticks are time intervals and all of them have the same duration " So the…
Michael Schnell wrote 18 lines
On 12/09/2011 02:52 PM, Sven Barth wrote: > > The description of Felipe mathes Windows' GetTickCount (number of > milliseconds since system start) and Linux' MONOTONIC_RAW time (or > however it is called exactly). So I don't see why this should rule out > OS time API calls... He writes: " Ticks are time intervals and all of them have the same duration " So the counting is not allowed to stop or to jump forward in case a time server access by daemon changing the system time is not allowed to interfere in any way. So I suppose "GetTickCount (number of milliseconds since system start)" would be OK, but MONOTONIC_RAW time does not _sound_ correct. On Linux, "get_jiffies_64()" seems to be a decent Kernel call.

You can't use this in userspace.

Henry

Reply by email

Tomas Hajny
to Michael Van Canneyt: Hola :-) I didn't say we should not accomodate it. I did say that *the decision* to…
Michael Van Canneyt wrote 33 lines
On Fri, 9 Dec 2011, Jonas Maebe wrote: >>> it also solves the problem that some targets may not support returning >>> the >>> time in UTC. >> >> I think that Michael already exposed more then enough the holes in >> this argument. > > He did not expose any holes in any argument. He simply said that Go32v2 > and > OS/2 can be ignored as far as any potential implementation problems are > concerned because Go32v2 and to a (much) lesser extent OS/2 do not > support > various features. I strongly disagree about the OS/2 part because its > target > support is still actively maintained, so the least courtesy we can do is > to > try to accomodate it rather than simply upfront state "if it doesn't > work for > your target, tough luck". Hola :-) I didn't say we should not accomodate it. I did say that *the decision* to introduce it should not depend on some specific older platforms not being able to support it, since this is true for other calls as well, and they were introduced nonetheless. If we decide to put it in, we should help Tomas finding an implementation method for OS/2. This is understood.

Thanks, but don't worry, I didn't take personally. ;-) I know the proper solution for both GO32v2 and OS/2 (and probably also other platforms not providing native support of timezone handling). As mentioned previously, this solution is based on parsing the TZ environment variable (see e.g. http://www.scribd.com/doc/70722660/37/The-TZ-Environment-Variable including the notes about the "alternative format used for OS/2" - and actually necessary for DOS / GO32v2 too).

The only trouble (and reason of my original comment) is that the system doesn't enforce existence or validity of this environment variable - it's merely a user setting. If it doesn't exist, the implementation needs to assume that local time = UTC.

Tomas

Reply by email

Henry Vermaak
to Sven Barth: I haven't found an entry for "MONOTONIC_RAW" (my system's manpage has one, but I'm…
Sven Barth wrote 27 lines
Am 09.12.2011 15:22, schrieb Michael Schnell: > On 12/09/2011 02:52 PM, Sven Barth wrote: >> >> The description of Felipe mathes Windows' GetTickCount (number of >> milliseconds since system start) and Linux' MONOTONIC_RAW time (or >> however it is called exactly). So I don't see why this should rule out >> OS time API calls... > > He writes: " Ticks are time intervals and all of them have the same > duration " > > So the counting is not allowed to stop or to jump forward in case a time > server access by daemon changing the system time is not allowed to > interfere in any way. > > So I suppose "GetTickCount (number of milliseconds since system start)" > would be OK, but MONOTONIC_RAW time does not _sound_ correct. I haven't found an entry for "MONOTONIC_RAW" (my system's manpage has one, but I'm currently at work), but for MONOTONIC: CLOCK_MONOTONIC Clock that cannot be set and represents monotonic time since some unspecified starting point. So even if a deamon plays around with the time the MONOTONIC clock should not be affected. That's the basic idea of the MONOTONIC clocks.

MONOTONIC can still be affected by NTP, MONOTONIC_RAW can't.

Henry

Reply by email

Marco van de Voort
to Michael Van Canneyt: Well, you'll have to convince Marco. But I think it's that time of the month, when he's…

In our previous episode, Michael Van Canneyt said:

Show quoted text 6 lines
> Freebsd, Netbsd, Openbsd, and Linux has it. > For OSX there is a substitution: > http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x Well, you'll have to convince Marco. But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :)

Strange. I had the same feeling. Something random functionality HAD to be put in, damn the consequences or counter arguments.

Reply by email

Henry Vermaak
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: Btw, you'll need clock_getres too, to…
Marco van de Voort wrote 13 lines
In our previous episode, Michael Van Canneyt said: > > No problem. > I will do it so, I was leaning to this anyway based on the mails of Zeljko some > weeks back where the OSX issue was already touched upon. > > I just wanted to know the POSIX situation first, and now that's cleared up. Btw, you'll need clock_getres too, to get the granularity of the relevant timer. (and anything using these, should really use that function) Still I think it is better to put this in a package, and link to libc for them, instead of pulling this into the core. (iow, like the users package)

I don't understand. Why link to libc for these? They are syscalls, if I'm not missing something.

Henry

Reply by email

Helmut Hartl
to Michael Van Canneyt: Well, you'll have to convince Marco. But I think it's that time of the month, when he's…
Michael Van Canneyt wrote 26 lines
On Fri, 9 Dec 2011, Helmut Hartl wrote: > >> Well, if OS-X does not have it, we can't really say it is POSIX for >> our purposes, so then it goes to the linux unit. It's as simple as >> that. >> > Only if you discriminate BSD systems :-) - Many professional vendors > use some sort of BSD in their products, > and some fpc. > > Freebsd, Netbsd, Openbsd, and Linux has it. > For OSX there is a substitution: > http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x Well, you'll have to convince Marco. But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :) But till you do convince him, I'll put it in the linux unit, and Marco can put it in a *BSD specific unit. That's what these units are for. Michael.

:-) Boy, I am happy that I dont need to convince anybody anymore.

@granularity:
The granularity is not only OS dependend but hardware dependend. In FreeBSD you have the granularity if you have a hardware high precision timer.
This can be queried via sysctls, i assume this is handled in other os's similar.
For our software we have to handle this target and hardware specific(!). But we use server appliance hardware with freebsd and fpc software for our products - and that is somewhat exotic.

@speed
The constants influence highly the time needed for the call, so in general you want to know what for you need the time base. Some background:
http://phk.freebsd.dk/pubs/timecounter.pdf

@portable NowUTC
I would have been happy if FPC had provided me the super ultra fast, high precise and platform independend timer routine, But i would not have been happy for long - As fpc simply can't read ones mind and be better then the underlying hardware/os. If i recall right we use 4 different timing mechanism throughout our source because we need them.

So if FPC provides a generic higher precise timing routine is should be documented that it is a starting point only.

But of course it would be nice for every day usage to have a cross platform call.

helmut

Reply by email

Marco van de Voort
to Henry Vermaak: I don't understand. Why link to libc for these? They are syscalls, if I'm not missing…

In our previous episode, Henry Vermaak said:

> them, instead of pulling this into the core. (iow, like the users package) I don't understand. Why link to libc for these? They are syscalls, if

Are they? On any OS and arch that calls itself posix or unix?

Or maybe, the question should be the opposite, why not? Why shouldn't such peripheral calls NOT be taken from libc?

$

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: Strange. I had the same feeling.…
Marco van de Voort wrote 10 lines
In our previous episode, Michael Van Canneyt said: >> Freebsd, Netbsd, Openbsd, and Linux has it. >> For OSX there is a substitution: >> http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x > > Well, you'll have to convince Marco. > But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :) Strange. I had the same feeling. Something random functionality HAD to be put in, damn the consequences or counter arguments.

Not quite.

If we're talking about clock_gettime, that was on my agenda since Zeljko pointed out their existence, as I stated in my initial post: "it is on my todo list".

It is a linux kernel call, and therefor earns its place at least in the linux unit, it is the purpose of that unit.

Concerning Felipe's functions NowUTC and gettickcount or whatever in sysutils: I am generally neutral, slightly in favour, but mostly just participating in the discussion;

Much like you, I suspect, with the possible difference that you are slightly (or much) against :-)

Michael.

Reply by email

zeljko
to Sven Barth: My comment was less for which timer type we should support, but more to have a argument…
Sven Barth wrote 48 lines
Am 09.12.2011 15:37, schrieb zeljko: > On Friday 09 of December 2011 14:52:56 Sven Barth wrote: > > Am 09.12.2011 13:30, schrieb Michael Schnell: > > > On 12/09/2011 01:17 PM, Felipe Monteiro de Carvalho wrote: > > >> I would like to define it like this: "FPGetTickCount returns the > > >> > > >> amount of ticks since an unspecified initial time. This initial > > >> time > > >> > > >> is unknown, but is fixed for the entire duration of the > > >> application. > > >> > > >> Ticks are time intervals and all of them have the same duration, > > >> but > > >> > > >> their exact meaning in terms of real world units like milliseconds > > >> is > > >> > > >> unspecified. FPGetTickCount is not affected by timezones and also > > >> not > > >> > > >> by the user changing the system clock." So it matches > > >> > > >> Windows.GetTickCount well but still is flexible enough to be > > >> > > >> implemented in other platforms. > > > > > > What if the PC is polling a time server or similar ? IMHO > > FPGetTickCount > > > > should not be affected by such interference. This rules out using OS > > > > > > time API calls. > > > > The description of Felipe mathes Windows' GetTickCount (number of > > > > milliseconds since system start) and Linux' MONOTONIC_RAW time (or > > > > however it is called exactly). So I don't see why this should rule out > > > > OS time API calls... > > No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on > older kernels. My comment was less for which timer type we should support, but more to have a argument for what Felipe said.

Ok, also I forgot to mention that MONOTNIC_RAW isn't interrupted by ntp but MONOTONIC IS so it's big diff.

zeljko

Reply by email

Michael Van Canneyt
to Tomas Hajny: Thanks, but don't worry, I didn't take personally. ;-) I know the proper solution for…
Tomas Hajny wrote 13 lines
Thanks, but don't worry, I didn't take personally. ;-) I know the proper solution for both GO32v2 and OS/2 (and probably also other platforms not providing native support of timezone handling). As mentioned previously, this solution is based on parsing the TZ environment variable (see e.g. http://www.scribd.com/doc/70722660/37/The-TZ-Environment-Variable including the notes about the "alternative format used for OS/2" - and actually necessary for DOS / GO32v2 too). The only trouble (and reason of my original comment) is that the system doesn't enforce existence or validity of this environment variable - it's merely a user setting. If it doesn't exist, the implementation needs to assume that local time = UTC.

Well, As long as it is documented properly, I don't think there is anything wrong with such an implementation.

Michael.

Reply by email

Sven Barth
to Marco van de Voort: In our previous episode, Henry Vermaak said: Are they? On any OS and arch that calls…
Marco van de Voort wrote 6 lines
In our previous episode, Henry Vermaak said: >> them, instead of pulling this into the core. (iow, like the users package) > > I don't understand. Why link to libc for these? They are syscalls, if Are they? On any OS and arch that calls itself posix or unix?

With that argumentation you could question any usage of syscalls in FPC as we're not using syscalls on Mac OS X...

Or maybe, the question should be the opposite, why not? Why shouldn't such peripheral calls NOT be taken from libc?

If that function is indeed used to implement a fpGetTickCount which is located in one of the core units (e.g. SysUtils) I wouldn't want to link to a libc version (this is of course only if that hypothetic function gets implemented in a core unit).

Also I personally(!) prefer direct "linkage" to the kernel.

Regards,
Sven

Reply by email

Sven Barth
to zeljko: Ok, also I forgot to mention that MONOTNIC_RAW isn't interrupted by ntp but MONOTONIC IS…
zeljko wrote 103 lines
On Friday 09 of December 2011 16:10:54 Sven Barth wrote: > Am 09.12.2011 15:37, schrieb zeljko: > > On Friday 09 of December 2011 14:52:56 Sven Barth wrote: > > > Am 09.12.2011 13:30, schrieb Michael Schnell: > > > > On 12/09/2011 01:17 PM, Felipe Monteiro de Carvalho wrote: > > > >> I would like to define it like this: "FPGetTickCount returns the > > > >> > > > >> amount of ticks since an unspecified initial time. This initial > > > >> time > > > >> > > > >> is unknown, but is fixed for the entire duration of the > > > >> application. > > > >> > > > >> Ticks are time intervals and all of them have the same duration, > > > >> but > > > >> > > > >> their exact meaning in terms of real world units like milliseconds > > > >> is > > > >> > > > >> unspecified. FPGetTickCount is not affected by timezones and also > > > >> not > > > >> > > > >> by the user changing the system clock." So it matches > > > >> > > > >> Windows.GetTickCount well but still is flexible enough to be > > > >> > > > >> implemented in other platforms. > > > > > > > > What if the PC is polling a time server or similar ? IMHO > > > > FPGetTickCount > > > > > > should not be affected by such interference. This rules out using OS > > > > > > > > time API calls. > > > > > > The description of Felipe mathes Windows' GetTickCount (number of > > > > > > milliseconds since system start) and Linux' MONOTONIC_RAW time (or > > > > > > however it is called exactly). So I don't see why this should rule out > > > > > > OS time API calls... > > > > No, MONOTONIC_RAW is introduced in 2.6.26 afair, so it won't run on > > older kernels. > > My comment was less for which timer type we should support, but more to > have a argument for what Felipe said. Ok, also I forgot to mention that MONOTNIC_RAW isn't interrupted by ntp but MONOTONIC IS so it's big diff.

Yes, Henry wrote that already as well...

Regards,
Sven

Reply by email

Thaddy
to Marco van de Voort: In our previous episode, Jonas Maebe said: Agree fully.
Marco van de Voort wrote 15 lines
In our previous episode, Jonas Maebe said: >> I know nothing about OS/2-eCS, but the same arguments as for Go32V2 >> apply as far as I am concerned. If all these platforms can guarantee >> returning correct UTC time, I do not see why we would not introduce >> it. > Afaik the original point was that some people were interested in some > kind of timestamp that does not jump around (except possibly when > overflowing). I don't think anyone particularly needed "the time in > UTC". Therefore, something like FPGetTickCount seems much more > appropriate than NowUTC, and it also solves the problem that some > targets may not support returning the time in UTC. Agree fully. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Except that it rules out writing standardscompliant internet applications? If the network stack isn't in userland, there
is no point in putting NowUTC or whatever in userland. Bout where are the network stacks in these legacy OS's?

Reply by email

Felipe Monteiro de Carvalho
to Marco van de Voort: In our previous episode, Henry Vermaak said: Are they? On any OS and arch that calls…
Marco van de Voort wrote
IMHO that should have been done in the first place. First research and find a workable, portable way, and only then put it up for inclusion.

Well, I was expecting a lot more of discussions about how to do it, maybe even some patches over my patch to help advance to a good final result. I certainly wasn't expecting so much discussion about if we should do about NowUTC, it seams that it doesn't require any file checking at all, my error was something else, using EpochToLocal which adds the Timezone information. This can be easily corrected by adding a EpochToUTC routine and this solution works fine in this machine too ;)

Felipe Monteiro de Carvalho

Reply by email

Marco van de Voort
to Michael Van Canneyt: Not quite. If we're talking about clock_gettime, that was on my agenda since Zeljko…

In our previous episode, Michael Van Canneyt said:

Show quoted text 10 lines
>> Well, you'll have to convince Marco. >> But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :) > > Strange. I had the same feeling. Something random functionality HAD to be > put in, damn the consequences or counter arguments. Not quite. If we're talking about clock_gettime, that was on my agenda since Zeljko pointed out their existence, as I stated in my initial post: "it is on my todo list".

Then also add the getres. Without it is useless, or will lead to bad code that makes assumptions about granularity.

It is a linux kernel call, and therefor earns its place at least in the linux unit, it is the purpose of that unit.

The linux unit is much more lowprio. The problem is more the reason.

Show quoted text 6 lines
Concerning Felipe's functions NowUTC and gettickcount or whatever in sysutils: I am generally neutral, slightly in favour, but mostly just participating in the discussion; Much like you, I suspect, with the possible difference that you are slightly (or much) against :-)

I'll summarize it:

- I don't like getting requests for addition of new functions to central highly portable units that are so whoefully underresearched.
- This comes from an urgent need for a windows call.
- Implementation of non unix was pretty much nonexistant.
- it had the danger of dragging in stuff like timezone parsing and other possibly distribution and OS specific config files.
- Then there is a suggestion to wave it away with clock_gettime
- which doesn't exist one some systems.
- with the intended parameter (MONOTONIC_RAW) that is not portable (did sb check non x86(_64) linux?), and essentially a kernel internal's loophole.

And most important of all, I still don't see why this should be in the core RTL. Syscall, libc or whatever. It is just an liability.

And as far as libc goes, I'm talking about library libc here, not unit libc. Nobody wants unit libc back, least of all me, since I siderailled it.

But that doesn't meant that libc should be ruled out for all purposes, and then specially the ones with systemwide userland state like timezones etc.

Reply by email

Henry Vermaak
to Marco van de Voort: In our previous episode, Henry Vermaak said: Are they? On any OS and arch that calls…
Marco van de Voort wrote 6 lines
In our previous episode, Henry Vermaak said: >> them, instead of pulling this into the core. (iow, like the users package) > > I don't understand. Why link to libc for these? They are syscalls, if Are they? On any OS and arch that calls itself posix or unix?

That's a question, not an answer. We have a linux unit, for instance.

Or maybe, the question should be the opposite, why not? Why shouldn't such peripheral calls NOT be taken from libc?

Because you don't have to link to libc when you have a syscall?

Henry

Reply by email

Marco van de Voort
to Sven Barth: With that argumentation you could question any usage of syscalls in FPC as we're not…

In our previous episode, Sven Barth said:

Show quoted text 9 lines
> In our previous episode, Henry Vermaak said: >>> them, instead of pulling this into the core. (iow, like the users package) >> >> I don't understand. Why link to libc for these? They are syscalls, if > > Are they? On any OS and arch that calls itself posix or unix? With that argumentation you could question any usage of syscalls in FPC as we're not using syscalls on Mac OS X...

True, but they are libc functions on OS X. This isn't.

Show quoted text 7 lines
> Or maybe, the question should be the opposite, why not? Why shouldn't such > peripheral calls NOT be taken from libc? If that function is indeed used to implement a fpGetTickCount which is located in one of the core units (e.g. SysUtils) I wouldn't want to link to a libc version (this is of course only if that hypothetic function gets implemented in a core unit).

I don't see why it should be in sysutils.

Also I personally(!) prefer direct "linkage" to the kernel.

Not always. See e.g. the readdir situation. Limiting the number of syscalls drastically speeds up the process.

In Windows you also often call user32, not kernel32.

Reply by email

Marco van de Voort
to Thaddy: Except that it rules out writing standardscompliant internet applications? If the network…

In our previous episode, Thaddy said:

Show quoted text 8 lines
>> kind of timestamp that does not jump around (except possibly when >> overflowing). I don't think anyone particularly needed "the time in >> UTC". Therefore, something like FPGetTickCount seems much more >> appropriate than NowUTC, and it also solves the problem that some >> targets may not support returning the time in UTC. > Agree fully. Except that it rules out writing standardscompliant internet applications?

No, it just says that one should try to multiplex multiple intentions (timing, running some event x times per second and "standardscompliant internet applications") on the same call

Reply by email

Marco van de Voort
to Henry Vermaak: That's a question, not an answer. We have a linux unit, for instance. Because you don't…

In our previous episode, Henry Vermaak said:

> Or maybe, the question should be the opposite, why not? Why shouldn't such > peripheral calls NOT be taken from libc? Because you don't have to link to libc when you have a syscall?

True. You just have to maintain the syscall. And polish away the cross platform issues. For core functionality that is worth the trouble (since it is also quickly noticed when it fails), for this IMHO not.

Reply by email

Sven Barth
to Marco van de Voort: In our previous episode, Sven Barth said: True, but they are libc functions on OS X. This…
Marco van de Voort wrote 6 lines
> Also I personally(!) prefer direct "linkage" to the kernel. Not always. See e.g. the readdir situation. Limiting the number of syscalls drastically speeds up the process. In Windows you also often call user32, not kernel32.

user32 is the interface to the kernel mode driver win32k which does all the hard work regarding the user interface. So it's a basic system component like kernel32 is. You can only compare them together to an "OS interface library" like libc.

Regards,
Sven

Reply by email

Sven Barth
to Felipe Monteiro de Carvalho: Well, I was expecting a lot more of discussions about how to do it, maybe even some…
Felipe Monteiro de Carvalho wrote 8 lines
On Fri, Dec 9, 2011 at 4:30 PM, Marco van de Voort wrote: > IMHO that should have been done in the first place. First research and find > a workable, portable way, and only then put it up for inclusion. Well, I was expecting a lot more of discussions about how to do it, maybe even some patches over my patch to help advance to a good final result. I certainly wasn't expecting so much discussion about if we should do well... you should know this mailing lists already... put up the

right words like "unicode string", "iterators" etc. and you can be sure that you need to buy more popcorn :P

Regards,
Sven

Reply by email

Michael Van Canneyt
to Marco van de Voort: In our previous episode, Michael Van Canneyt said: Then also add the getres. Without it…
Marco van de Voort wrote 14 lines
In our previous episode, Michael Van Canneyt said: >>> Well, you'll have to convince Marco. >>> But I think it's that time of the month, when he's hard to convince, just for the fun of discussion :) >> >> Strange. I had the same feeling. Something random functionality HAD to be >> put in, damn the consequences or counter arguments. > > Not quite. > > If we're talking about clock_gettime, that was on my agenda since Zeljko pointed out > their existence, as I stated in my initial post: "it is on my todo list". Then also add the getres. Without it is useless, or will lead to bad code that makes assumptions about granularity.

That was the intention. Simply adding definitions for

int clock_getres(clockid_t clk_id, struct timespec *res);
int clock_gettime(clockid_t clk_id, struct timespec *tp);
int clock_settime(clockid_t clk_id, const struct timespec *tp);

to the linux unit, as per the linux man page for these calls. No more, no less.

Michael.

Reply by email

Michael Van Canneyt
to Sven Barth: right words like "unicode string", "iterators" etc. and you can be sure that you need to…
Sven Barth wrote 14 lines
Am 09.12.2011 16:54, schrieb Felipe Monteiro de Carvalho: > On Fri, Dec 9, 2011 at 4:30 PM, Marco van de Voort wrote: >> IMHO that should have been done in the first place. First research and >> find >> a workable, portable way, and only then put it up for inclusion. > > Well, I was expecting a lot more of discussions about how to do it, > maybe even some patches over my patch to help advance to a good final > result. I certainly wasn't expecting so much discussion about if we > should do it at all. Oh well... you should know this mailing lists already... put up the right words like "unicode string", "iterators" etc. and you can be sure that you need to buy more popcorn :P

Careful, you may start a discussion about popcorn...

Michael.

Reply by email

Michael Van Canneyt
to Michael Van Canneyt: That was the intention. Simply adding definitions for int clock_getres(clockid_t clk_id,…
Michael Van Canneyt wrote 29 lines
On Fri, 9 Dec 2011, Marco van de Voort wrote: > In our previous episode, Michael Van Canneyt said: >>>> Well, you'll have to convince Marco. >>>> But I think it's that time of the month, when he's hard to convince, >>>> just for the fun of discussion :) >>> >>> Strange. I had the same feeling. Something random functionality HAD to be >>> put in, damn the consequences or counter arguments. >> >> Not quite. >> >> If we're talking about clock_gettime, that was on my agenda since Zeljko >> pointed out >> their existence, as I stated in my initial post: "it is on my todo list". > > Then also add the getres. Without it is useless, or will lead to bad code > that makes assumptions about granularity. That was the intention. Simply adding definitions for int clock_getres(clockid_t clk_id, struct timespec *res); int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_settime(clockid_t clk_id, const struct timespec *tp); to the linux unit, as per the linux man page for these calls. No more, no less.

Done. Revision 19789.

Michael.

Reply by email

Sven Barth
to Michael Van Canneyt: Careful, you may start a discussion about popcorn... Michael.
Michael Van Canneyt wrote 21 lines
On Fri, 9 Dec 2011, Sven Barth wrote: > Am 09.12.2011 16:54, schrieb Felipe Monteiro de Carvalho: >> On Fri, Dec 9, 2011 at 4:30 PM, Marco van de Voort >> wrote: >>> IMHO that should have been done in the first place. First research >>> and find >>> a workable, portable way, and only then put it up for inclusion. >> >> Well, I was expecting a lot more of discussions about how to do it, >> maybe even some patches over my patch to help advance to a good final >> result. I certainly wasn't expecting so much discussion about if we >> should do it at all. > > Oh well... you should know this mailing lists already... put up the > right words like "unicode string", "iterators" etc. and you can be > sure that you need to buy more popcorn :P Careful, you may start a discussion about popcorn...

Oh right O.o

I should have paid more attention ^^

Regards,
Sven

Reply by email

Sven Barth
to Marco van de Voort
Marco van de Voort wrote 8 lines
In our previous episode, Michael Van Canneyt said: >> Oh well... you should know this mailing lists already... put up the right >> words like "unicode string", "iterators" etc. and you can be sure that you >> need to buy more popcorn :P > > Careful, you may start a discussion about popcorn... Not if it is portable...

*rofl*

That statement just made my day :D

Regards,
Sven

Reply by email

waldo kitty
to Tomas Hajny: Obviously assuming that something like that is possible on a certain platform at all…
Tomas Hajny wrote 14 lines
On Fri, December 9, 2011 13:07, Jonas Maebe wrote: > On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: > >> The linux kernel returns UTC time, it always has. Now() converts >> this to local time. >> (as does libc). All NowUTC needs to do is return the kernel time. > > It should only be called NowUTC if it is defined as always returning > UTC on all platforms. Obviously assuming that something like that is possible on a certain platform at all (GO32v2 not having the TZ environment variable defined will simply never be able to provide UTC time; in fact, the same applies for OS/2 / eCS too).

never say never... my OS/2 systems do know about and use the TZ environment variable... some programs on those systems also use the TZUTC environment variable... my oldest OS/2 system is Warp 3 Connect and it has been using these EVs since Warp 3 Connect was made available to the public ;)

now, i should point out, which i kinda of lightly did above, that the OS may or may not use these but those programs which know about them can and do...

Reply by email

Tomas Hajny
to waldo kitty
waldo kitty wrote 26 lines
On 12/9/2011 07:13, Tomas Hajny wrote: > On Fri, December 9, 2011 13:07, Jonas Maebe wrote: >> On 09 Dec 2011, at 12:28, Michael Van Canneyt wrote: >> >>> The linux kernel returns UTC time, it always has. Now() converts >>> this to local time. >>> (as does libc). All NowUTC needs to do is return the kernel time. >> >> It should only be called NowUTC if it is defined as always returning >> UTC on all platforms. > > Obviously assuming that something like that is possible on a certain > platform at all (GO32v2 not having the TZ environment variable defined > will simply never be able to provide UTC time; in fact, the same applies > for OS/2 / eCS too). never say never... my OS/2 systems do know about and use the TZ environment variable... some programs on those systems also use the TZUTC environment variable... my oldest OS/2 system is Warp 3 Connect and it has been using these EVs since Warp 3 Connect was made available to the public ;) now, i should point out, which i kinda of lightly did above, that the OS may or may not use these but those programs which know about them can and do...

I don't say never, just that neither DOS nor OS/2 enforce or validate this setting and thus it's purely up to the user to make sure that it eventually works. Not even mentioning the attempts of an author of certain command shell who apparently tries to make the situation even more confusing (however smart he may be) by trying to convince others that IBM wanted something else than what they really did :/ (if you don't know whom or what I talk about, forget it, it isn't very important).

Tomas

Reply by email

waldo kitty
to Tomas Hajny
Tomas Hajny wrote 21 lines
On Tue, December 13, 2011 01:08, waldo kitty wrote: > On 12/9/2011 07:13, Tomas Hajny wrote: >> >> Obviously assuming that something like that is possible on a certain >> platform at all (GO32v2 not having the TZ environment variable defined >> will simply never be able to provide UTC time; in fact, the same applies >> for OS/2 / eCS too). > > never say never... my OS/2 systems do know about and use the TZ > environment variable... some programs on those systems also use the TZUTC > environment variable... my oldest OS/2 system is Warp 3 Connect and it has > been using these EVs since Warp 3 Connect was made available to the public > ;) > > now, i should point out, which i kinda of lightly did above, that the OS > may or may not use these but those programs which know about them can and > do... I don't say never, just that neither DOS nor OS/2 enforce or validate this setting and thus it's purely up to the user to make sure that it eventually works.

i understand and yes, you are right, neither of them enforces or validates this setting... i was, actually, aiming at "never" in "[...] will never be able to [...]" all my systems, OS/2, DOS, Winwhatever, and linux are set to local time... when they need to provide a UTC timestamp, they do otherwise it is local time... at least this is my experience and has been for "ever"... i have never run any of my systems in UTC time and expected them to convert all the time to local time...

however, back to the TZ and such... i wrote a library for TP6/BP6 that emulated parts of the C time stuff using a slightly modified tm_rec... i needed this so i could work on an external means of changing some settings when daylight saving switched on and off in my area... these settings were specific to a few programs and i wanted to automate the switchover so that their outputs were not an hour off either way... i even took the opportunity to "borrow" novell's DSTSTART and DSTSTOP style settings... they look like this...

DSTSTART=second sunday in march at 2:00
DSTSTOP=first sunday in november at 2:00

granted, that info may be gleaned from the long form of TZ but i didn't code for that in my stuff at that time... i was only interested in the current timezone, what the offset from UTC was at the time, and when daylight saving switched on and off... i still use this at least eight year old code in numerous projects i still maintain with TP/BP6 ;)

Show quoted text 5 lines
Not even mentioning the attempts of an author of certain command shell who apparently tries to make the situation even more confusing (however smart he may be) by trying to convince others that IBM wanted something else than what they really did :/ (if you don't know whom or what I talk about, forget it, it isn't very important).

yes, i know exactly who you are talking about ;) i was an active beta tester of his products as well as a distributor of them on fidonet... i'm still on fidonet but haven't heard anything from JdBP in a long while...

Reply by email