Jump to content

Ian Branch

Members
  • Content Count

    542
  • Joined

  • Last visited

  • Days Won

    1

Ian Branch last won the day on August 8 2019

Ian Branch had the most liked content!

Community Reputation

48 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ian Branch

    How to get the actual UTC time??

    Hi Remy, Thank you for the vey informative response. Appreciated. I have ended up using IdSNTP1.Host := 'time-a.nist.gov'; as it gives me a direct comparison between what the time should be v what the PC says. This I can work with. Regards & Thanks again, Ian
  2. Ian Branch

    How to get the actual UTC time??

    HI Guys, Not to prolong this thread any longer than necessary... This is what I have att. 1. GetSystemTime returns a 'UTC' time but it seems it is derived from the local PC time. - No good to me. 2. IdSNTP1.Host := 'time-a.nist.gov'; returns my local time. - No good to me. 3. IdDayTime1.Host := 'time-a.nist.gov'; returns what appears to be a complete UTC date/time string. - If this is true then it is exactly what I need. I continue to experiment. Regards and again thanks to all for your inputs. Ian
  3. Ian Branch

    How to get the actual UTC time??

    Ahhh. Tks Angus.
  4. Ian Branch

    How to get the actual UTC time??

    All, Nothing like a kick in the right direction. Forest & Trees and all that. Oh so simple using Indy's idDayTime component. IdDayTime1.Host := 'time-a.nist.gov'; Label1.Caption := IdDayTime1.DayTimeStr; My thanks to all for your patience and suggestions. Regards, Ian
  5. Ian Branch

    How to get the actual UTC time??

    Angus, Thank you, correct me if I am wrong but this appears to use the local time as its basis. dummzeuch, Thank you. I am aware of various hardware methods but the End User isn't interested. He has the habit of letting his Server clock 'run free' and after a couple of months it can be 2+ minutes out. He doesn't want to sync with nntp as his Country plays funny with daylight savings. Additionally he is forgetful (did I say lazy) about checking and correcting the server. So, I thought if could detect the time difference between UTC and his Server clock I could overtly flag (remind) him that it needs adjusting. David, Absolutely, that is why I thought of reading a UTC/GMT clock from somewhere. Is it possible to read the date/time form one of those internet time sources? Regards and thanks to all, Ian
  6. Ian Branch

    How to get the actual UTC time??

    Hi David, Well I guess that is where I am a little lost. Hmmm. I'm guessing GMT date time doesn't have daylight savings and is therefore effectively UTC time, so I guess the trick would be to source from a GMT clock somehow?? Ian
  7. Ian Branch

    How to get the actual UTC time??

    Hi Wagner, Thank you for your suggestion. My read of "TTimeZone.Local.ToUniversalTime" in the Delphi docs is that it derives the UTC from your Local. This is no good if the time on your local PC is incorrect. This isn't what I am after, I am after the actual UTC date/time. Regards, Ian
  8. Ian Branch

    How to get the actual UTC time??

    Hi Guys, Is there a way to retrieve the actual UTC date/time? All the routines I can find work backwards from local date/time. Regards & TIA, Ian
  9. Ian Branch

    smtp client in a console app??

    Doh! Stupid, stupid me! I forgot to put the two .dll files in the project directory. :-( All good now. Thanks Guys, Ian
  10. Ian Branch

    smtp client in a console app??

    Hi Guys, D10.4.2, latest Indy 10, Win 10. I have created a console app with my Indy code in it. The code is exactly the same as I have in my VCL app, same settings/parameters, etc, which works. But. When I run it in the cmd prompt I get the following error. >>EIdTLSClientTLSHandShakeFailed: SSL negotiation failed.<< Now, I freely acknowledge I probably don't have something set right. 😞 Here is the source I have att.. program DBiPREmail; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, IdMessage, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdBaseComponent, IdComponent, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdAttachment, IdMessageParts, IdEMailAddress, IdAttachmentFile, IdGlobal, IdText; // These are all in just to start. To be cleaned up when working.. var dmPREmail: TdmPREmail; IdSMTP: TIdSMTP; IdMessage: TIdMessage; IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL; // to allow SSL authenticate // try // try // IdSMTP := TIdSMTP.Create(nil); // try // IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(IdSMTP); // IdMessage := TIdMessage.Create(IdSMTP); // // IO HANDLER SETTINGS // with IdSSLIOHandlerSocketOpenSSL1 do begin MaxLineAction := maException; SSLOptions.Method := sslvTLSv1; end; // IdSMTP.Host := 'my smtp email host'; // IdSMTP.Port := 587; // IdSMTP.Username := 'my user name'; IdSMTP.Password := 'my password'; // IdSMTP.IOHandler := IdSSLIOHandlerSocketOpenSSL1; IdSMTP.AuthType := satDefault; // IdSMTP.UseTLS := utUseExplicitTLS; // // SETTING email MESSAGE DATA // IdMessage.Clear; // IdMessage.From.Address := 'my email address'; IdMessage.Recipients.EMailAddresses := 'second email address'; IdMessage.CCList.EMailAddresses := 'third email address'; // IdMessage.Subject := 'Test Email Subject'; IdMessage.Body.text := 'Test Email Body'; IdMessage.Priority := mpHigh; // with TIdText.Create(IdMessage.MessageParts, nil) do begin // Body.text := Body.text + '<p style="color: #5e9ca0;">This is a test <strong>message</strong> for <span style="color: #ff0000;"><strong>emailing</strong></span>.</p><h1 style="color: #5e9ca0;"> </h1>'; ContentType := 'text/html'; end; // IdMessage.ContentType := 'multipart/mixed'; // try IdSMTP.Connect; except on E: Exception do begin Writeln(E.ClassName, ': ', E.Message); Exit; end; end; // try try IdSMTP.Send(IdMessage); finally IdSMTP.Disconnect(); end; except on E: Exception do begin Writeln(E.ClassName, ': ', E.Message); Exit; end; end; // finally // IdSMTP.Free; // end; // except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; // end. Thoughts, suggestions appreciated.. Regards & TIA, Ian
  11. Ian Branch

    Something's changed in my IDE??

    Ah Ha! Thank you. No wonder I couldn't find it. I was looking in the wrong place. All sorted now. Still to wonder why/how it changed, but all god now. Thanks again, Ian
  12. Hi Team, D10.4.2, Win 10. Something has changed in my IDE and now when I Format Project Source the code is indented by 8 instead of my normal 2. See attached image. I thought this was controlled by the Continuation indent setting of Indentation in the Formatter settings but that hasn't changed. What may have changed/be affecting this please? Regards & TIA, Ian
  13. Ian Branch

    Snap to Grid??

    Ahhh, Thank you. The latter will do nicely. Regards & Tks, Ian
  14. Ian Branch

    Snap to Grid??

    Hi Team, I am about to start reworking an old project, started in D7, got updated to D2007, now updating to D10. I have Snap to Grid enabled in D10. When I open the old forms, will they automatically snap to their nearest grid points or do I have to do it manually? Regards & TIA, Ian
  15. Ian Branch

    Tab Order Confusion..

    Hi David, 100% correct! Something I never came across before. Something learnt for today. Thanks again. Regards, Ian
×