<div dir="ltr"><div class="gmail_default" style="color:rgb(7,55,99)"><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">Thomas,</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">We've had this conversation many years ago. I think you said you spent some time in Santa Monica. I was living in Redondo beach at the time. I live in Palos Verdes now (still the LA area).</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">Have you thought about how best to deal with the two cases that I've run into?</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">I took a quick look at the libofx code that you modified so many years ago. Further down in the code (copied below) it checks if the time zone is specified and if it's not it is supposed to assume 11:59:00 local time.</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">In the two cases that I've run into the time zone is not specified in the DTEND field so I would expect the time to be set to 11:59:00 local time and it should work. In one case DTEND is not specified so I'm not sure it gets this far but in the other it does not appear to be specified. I did see other ofx files with the DTEND time zone specified so I'm wondering why this is not working.</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">It appears that time_zone_specified is being set improperly. I'm not sure why since there is not a "[" in the DTEND value in the ofx file that seems to be adjusting to the previous day.</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif">I have no idea how to figure out what libofx does when DTEND is missing. I'd guess nothing and that KMM had to deal with getting nothing back. Could KMM handle getting a zero or null for DTEND better?</div><div class="gmail_default" style="font-size:small;font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><font size="1">==============================<wbr>=========</font></div><div class="gmail_default"><font face="monospace, monospace" size="1"><div class="gmail_default"> /* Check if the timezone has been specified */</div><div class="gmail_default">    string::size_type startidx = ofxdate.find("[");</div><div class="gmail_default">    string::size_type endidx;</div><div class="gmail_default">if (startidx != string::npos)</div><div class="gmail_default">    {</div><div class="gmail_default">      /* Time zone was specified */</div><div class="gmail_default">      time_zone_specified = true;</div><div class="gmail_default">      startidx++;</div><div class="gmail_default">      endidx = ofxdate.find(":", startidx) - 1;</div><div class="gmail_default">      ofx_gmt_offset = atof(ofxdate.substr(startidx, (endidx - startidx) + 1).c_str());</div><div class="gmail_default">      startidx = endidx + 2;</div><div class="gmail_default">      strncpy(timezone, ofxdate.substr(startidx, 3).c_str(), 4);</div><div class="gmail_default">    }</div><div class="gmail_default">    else</div><div class="gmail_default">    {</div><div class="gmail_default">      /* Time zone was not specified, assume GMT (provisionnaly) in case exact time is specified */</div><div class="gmail_default">      ofx_gmt_offset = 0;</div><div class="gmail_default">      strcpy(timezone, "GMT");</div><div class="gmail_default">    }</div></font></div><div class="gmail_default"><font face="monospace, monospace" size="1"><br></font></div><div class="gmail_default"><font face="monospace, monospace" size="1">if (time_zone_specified == true)</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    {</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      /* If the timezone is specified always correct the timezone */</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      /* If the timezone is not specified, but the exact time is, correct the timezone, assuming GMT following the spec */</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      /* Correct the time for the timezone */</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      time.tm_sec = time.tm_sec + (int)(local_offset - (ofx_gmt_offset * 60 * 60)); //Convert from fractionnal hours to seconds</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    }</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    else if (exact_time_specified == false)</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    {</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      /*Time zone data missing and exact time not specified, diverge from the OFX spec ans assume 11h59 local time */</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      time.tm_hour = 11;</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      time.tm_min = 59;</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">      time.tm_sec = 0;</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    }</font></div><div class="gmail_default"><font face="monospace, monospace" size="1">    return mktime(&time);</font></div></div><div class="gmail_extra"><br clear="all"><div><div class="m_9196478270627998231gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font face="tahoma, sans-serif" size="2" color="#073763"><b><br>----<br>Brendan</b></font><br></div></div></div>
<br><div class="gmail_quote">On Fri, Jan 13, 2017 at 6:46 AM, <a href="mailto:jeffjl@outlook.com" target="_blank">jeffjl@outlook.com</a> <span dir="ltr"><<a href="mailto:jeffjl.kde@outlook.com" target="_blank">jeffjl.kde@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div bgcolor="#FFFFFF" text="#000000"><span>
<br>
<div class="m_9196478270627998231m_827169509647566025moz-cite-prefix">On 1/13/2017 3:36 AM, Thomas Baumgart wrote:<br>
</div>
<blockquote type="cite">Thanks for the detailed analysis. I think it hits the nail right on the head.
<pre>Date and timezone handling is all done by libOFX (I fixed something myself in 
that are sometime ago - wow 7 years: 
<a class="m_9196478270627998231m_827169509647566025moz-txt-link-freetext" href="https://github.com/libofx/libofx/commit/166b97964de3ed3986346f8844d8029ca11e3d79" target="_blank">https://github.com/libofx/libo<wbr>fx/commit/166b97964de3ed398634<wbr>6f8844d8029ca11e3d79</a>, 
the internet does not forget)

Not sure what we can do about it since all that is handled by libOFX AFAIR. </pre>
</blockquote></span>
I had the same exact problem with libOFX on Windows. A time of midnight was getting converted to 11:00 PM the previous day when daylight savings time was not in effect. I fixed it in my local build of libOFX by changing line 118 of Thomas' patch to
<br>
<br>
<span class="m_9196478270627998231m_827169509647566025pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(234,255,234)">time</span><span style="color:rgb(51,51,51);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(234,255,234);display:inline!important;float:none">.</span><span class="m_9196478270627998231m_827169509647566025pl-smi" style="box-sizing:border-box;color:rgb(51,51,51);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(234,255,234)">tm_isdst</span><span style="color:rgb(51,51,51);font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;background-color:rgb(234,255,234);display:inline!important;float:none">
 = -1; //mktime() will figure out daylight savings based on locale</span><br>
<br>
For me, this works both when DST is in effect and when it is not.<br>
</div>

</blockquote></div><br></div></div>