{"id":10,"date":"2003-08-16T07:12:00","date_gmt":"2003-08-16T07:12:00","guid":{"rendered":"http:\/\/jclark.org\/weblog\/WebDev\/Blosxom\/not1969.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"not1969","status":"publish","type":"post","link":"https:\/\/jclark.org\/weblog\/2003\/08\/16\/not1969\/","title":{"rendered":"Party like it&#8217;s 1969"},"content":{"rendered":"<p>One the first plugins I decided to use for this weblog was <a href=\"http:\/\/www.blosxom.com\/plugins\/edit\/wikieditish.htm\">wikieditish<\/a>, a fantastic plugin by <a href=\"http:\/\/www.raelity.org\">Rael Dornfest<\/a>, author of Blosxom.  This plugin allows the posting and editing of blog entrys via a web page.  Among its features are password protection and modification date preservation.<\/p>\n<p>Date preservation is important, because Blosxom uses a story&#8217;s file-system modification time as the posting time of the story. However, when I started using it, new posts created by wikieditish all had a date of Dec 31, 1969 at 16:00.  A search of the <a href=\"http:\/\/groups.yahoo.com\/group\/blosxom\/\">Blosxom mailing list<\/a> found a description of the problem, but not the solution.  <\/p>\n<p>Eventually, I worked it out.  The problem is caused when $preserve_lastmodified is set.  In the following code, the comment says something the code does not:<\/p>\n<pre><code> # If file already exists, memorize the lastmodified date\/time\n  my $mtime = (stat &quot;$blosxom::datadir$path\/$fn.$file_extension&quot;)[9];<\/code><\/pre>\n<p>There is no If in the code &#8211; when the file does not exist, the stat call returns no value.  So when $mtime is used later, its numeric value is 0:<\/p>\n<pre><code> # reset lastmodified date\/time to memorized value (if possible)\n     $preserve_lastmodified\n       and utime(time, $mtime, &quot;$blosxom::datadir$path\/$fn.$file_extension&quot;)\n         ? $response .= &quot; Preserved last modified date\/time.&quot;\n         : warn &quot;blosxom : wikieditish plugin : couldn&#039;t reset lastmodified \n           time on $blosxom::datadir$path\/$fn.$file_extension.&quot;;<\/code><\/pre>\n<p>utime expects a date\/time value as seconds since the epoch. The epoch is Jan 1, 1970, 00:00 <span class=\"caps\">GMT. <\/span>Those of us west of <span class=\"caps\">GMT<\/span> see this as a time during the evening of Dec 31, 1969. In my case, 16:00, which is 8 hours prior to midnight, which tells me my host in on Pacific time.<\/p>\n<p>My fix for this is brief. In the above code, we don&#8217;t proceed if $mtime is 0:<\/p>\n<pre><code> # reset lastmodified date\/time to memorized value (if possible)\n     $preserve_lastmodified\n       and $mtime\n       and utime(time, $mtime, &quot;$blosxom::datadir$path\/$fn.$file_extension&quot;)\n       ? $response .= &quot; Preserved last modified date\/time.&quot;\n       : warn &quot;blosxom : wikieditish plugin : couldn&#039;t \n         reset lastmodified time on\n$blosxom::datadir$path\/$fn.$file_extension.&quot;;<\/code><\/pre>\n<p>Its possible some people don&#8217;t have this problem with the code as written. Judging from the code, I think perhaps utime is expected to fail with a 0 arg. Since utime is just a wrapper for utime(2) on most systems, this could be a difference between *nix implementations&#8230; but that&#8217;s all theory :) The code fix however is actually tested.<\/p>","protected":false},"excerpt":{"rendered":"<p>One the first plugins I decided to use for this weblog was wikieditish, a fantastic plugin by Rael Dornfest, author of Blosxom. This plugin allows the posting and editing of blog entrys via a web page. Among its features are password protection and modification date preservation. Date preservation is important, because Blosxom uses a story&#8217;s [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-blosxom"],"_links":{"self":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jclark.org\/weblog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}