Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Paul Nance
Actually the Julian calendar started at noon, the 0.5 is added to get to midnight. The Julian calendar was developed for astronomers, who view the sky when it gets dark and want all observing to be referenced to the same date. Us normal people start our day at midnight so we have to add the extra h

Re: [fpc-pascal] Best way to insert bytes into a TBytes variable?

2017-08-01 Thread Michael Schnell
On 30.07.2017 12:37, Bo Berglund wrote: I asked about this problem over at Embarcadero too, but was flamed foreven thinking about using any kind of string for storing binary data. They are silly and defending their completely silly implementation of Code aware strings, forcing UTF-16 for any TSt

Re: [fpc-pascal] Best way to insert bytes into a TBytes variable?

2017-08-01 Thread Michael Schnell
On 30.07.2017 08:06, Bo Berglund wrote: All of this is because I have found that using AnsiString is triggering data changes when the application is running in certaincountries (locales) and processing certain data values... I am rather sure that this can be avoided. -Michael

[fpc-pascal] Syncobjs Event and BlockWrite() question

2017-08-01 Thread Brian
When using WaitFor() , ResetEvent and SetEvent as a semaphore , if a thread is using BlockWrite() and the execution of BlockWrite() is conditional on WaitFor() , will BlockWrite() continue to function after it is called once MySemaphore.ResetEvent is called ? A pseudo code example below ---

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Mark Morgan Lloyd
On 01/08/17 12:15, Dennis Poon wrote: Vojtěch Čihák wrote:>> Hi,>> wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian > day number 0 assigned to the day starting at noon on January 1, 4713 > BC, ...">> The noon means 0,5.>Thanks,that is a weird definition though IMHO. Astronome

[fpc-pascal] Is it always safe to typecast a old style object as its parent?

2017-08-01 Thread Dennis
TParent = object A : integer; end; TChild=object(TParent) B : integer; end; var Parent : TParent; Child : TChild; begin Child.A := 10; Child.B := 20; Parent := TParent(Child );// is this always safe ? Will it copy ONLY the 'A' field to 'parent'? Will it overwr

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Dennis Poon
Vojtěch Čihák wrote: Hi, wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, ..." The noon means 0,5. Thanks, that is a weird definition though IMHO. Dennis

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Vojtěch Čihák
Hi,   wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, ..." The noon means 0,5.   V. __ Od: Dennis Komu: FPC-Pascal users discussions Datum: 0

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Vojtěch Čihák
Hi,   wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, ..." The noon means 0,5.   V. __ Od: Dennis Komu: FPC-Pascal users discussions Datum: 0

[fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Dennis
I just noticed that the definition of the constants have 0.5 in it. Why? from dateh.inc const JulianEpoch = TDateTime(-2415018.5); UnixEpoch = JulianEpoch + TDateTime(2440587.5); Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.o