Sign in Join

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

Mailing lists / lazarus / 2009-06

New Personal Message: Re: Problema con setdatetime

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Google translation of the mail:

Sorry to disturb you first because it's in Italian, second, because' like me you've had the problem to translate the procedure setdatetime Lazarus on Delphi, I have seen the answers that you gave but then I lost, how do I convert a TDateTime in a ptimeval for fpsettimeofday function (tp: ptimeval; TZP: ptimezone): CInt; you how you resolved? Thanks Brunello

2009/6/6 Brunello Candelaresi :

Show quoted text 100 lines
grazie mille per la tempestivita' e la disponibilita' ora provo subito, ciao Brunello ________________________________ Da: Lazarus A: Inviato: Sabato 6 giugno 2009, 9:58:10 Oggetto: New Personal Message: Re: Problema con setdatetime You have just been sent a personal message by mrdebug on Lazarus. IMPORTANT: Remember, this is just a notification. Please do not reply to this email. The message they sent you was: Quote from: brunello on June 05, 2009, 11:19:55 pm scusa la sfacciataggine ma ti disturbo primo perche' sei italiano, secondo perche' come me hai avuto il problema di traslare la procedura setdatetime di Delphi su Lazarus, ho visto le risposte che ti hanno dato ma a quel punto mi sono perso,? come faccio a convertire un TDateTime in un ptimeval per la function fpsettimeofday(??tp: ptimeval;??tzp: ptimezone):cint; tu come hai risolto? Grazie Brunello Prova questo: Code: ? {$ifdef linux} ? ? TSTOra: TSystemTime; ? ? TVOra: TimeVal; ? ? TZZona: TimeZone; ? ? TDTDataOra: TDateTime; ? {$else} ? ? mDay: Word; ? {$endif} ? ? ? ? ? ? {$ifdef linux} ? ? ? ? ? ? ? try ? ? ? ? ? ? ? ? TDTDataOra:= EncodeDateTime(anno, mese, giorno, ore, minuti, secondi, millisecondi); ? ? ? ? ? ? ? ? if fpGetTimeOfDay(@TVOra, @TZZona)= 0 then begin ? ? ? ? ? ? ? ? ? TDTDataOra:= IncMinute(TDTDataOra, TZZona.tz_minuteswest); ? ? ? ? ? ? ? ? ? DateTimeToSystemTime(TDTDataOra, TSTOra); ? ? ? ? ? ? ? ? ? TVOra.tv_sec:= DateTimeToUnix(TDTDataOra); ? ? ? ? ? ? ? ? ? TVOra.tv_usec:= TSTOra.MilliSecond; ? ? ? ? ? ? ? ? ? if fpSetTimeOfDay(@TVOra, @TZZona)= 0 then begin ? ? ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Ok'); ? ? ? ? ? ? ? ? ? end else begin ? ? ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Error'); ? ? ? ? ? ? ? ? ? end; ? ? ? ? ? ? ? ? end else begin ? ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Error'); ? ? ? ? ? ? ? ? end; ? ? ? ? ? ? ? ? Except on e: Exception do begin ? ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Error'); ? ? ? ? ? ? ? ? ? MainForm.Log('TTCPHttpThrd.ProcessHttpRequest() '+ e.Message); ? ? ? ? ? ? ? ? end; ? ? ? ? ? ? ? end; ? ? ? ? ? ? {$endif} ? ? ? ? ? ? {$ifdef win32} ? ? ? ? ? ? ? try ? ? ? ? ? ? ? ? mDay:= 0; ? ? ? ? ? ? ? ? SetDate(anno, mese, giorno); ? ? ? ? ? ? ? ? SetTime(ore, minuti, secondi, Word(millisecondi div 10)); ? ? ? ? ? ? ? ? GetDate(anno, mese, giorno, mDay); ? ? ? ? ? ? ? ? GetTime(ore, minuti, secondi, millisecondi); ? ? ? ? ? ? ? ? MainForm.Log('TTCPHttpThrd.ProcessHttpRequest() DataOra: '+ FillStringLeft(IntToStr(giorno), '0', 2)+ '/'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(mese), '0', 2)+ '/'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(anno), '0', 2)+ '/'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(ore), '0', 2)+ ':'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(minuti), '0', 2)+ ':'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(secondi), '0', 2)+ ':'+ ? ? ? ? ? ? ? ? FillStringLeft(IntToStr(millisecondi* 10), '0', 3)); ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Ok'); ? ? ? ? ? ? ? ? MainForm.Log('TTCPHttpThrd.ProcessHttpRequest() DataOra: '+ DateTimeToStr(Now)); ? ? ? ? ? ? ? ? Except on e: Exception do begin ? ? ? ? ? ? ? ? ? AggiungiAttributo(XmlDocOut, nodoPrimoLivelloDomOut, 'Esito', 'Error'); ? ? ? ? ? ? ? ? ? MainForm.Log('TTCPHttpThrd.ProcessHttpRequest() '+ e.Message); ? ? ? ? ? ? ? ? end; ? ? ? ? ? ? ? end; ? ? ? ? ? ? {$endif} Reply to this Personal Message here: http://www.lazarus.freepascal.org/index.php?action=pm;sa=send;f=inbox;pmsg=992;quote;u=13505
Felipe Monteiro de Carvalho

Reply by email