One of those days…

  • Had the joy of being awaken this morning by the sound of my computer backup batteries alarm going off. Nothing like losing electricity early in the morning. Normally, that’s not a big deal, but since my router isn’t on a battery backup my whole network went to shit, and lost all it’s settings. Ended up spending an hour getting the damn thing back up again. D’Oh!
  • I’m also to the point where I’ve given up hope that the Yahoo plugin for Gaim is going to be fixed anytime soon. So, if anyone wants to contact me by IM, you’ll need to use Jabber (id: bdpepple@jabber.org) or AIM (id: pepplebd).
  • Haven’t done anything substantial code-wise the last few days. I’ve been working on a section of code that has to deal with converting a string representation of time to a time structure, which has proven to be a real pain. To handle this, you should only need to use a strptime call. Turns out though, glibc2 only provides a prototype for this when either _XOPEN_SOURCE or _GNU_SOURCE are defined. Arrggh! Not too terribly hard to add this to my project, but still, what a pain! I’m at the point now where I need to debug a section of code that is giving me incorrect data. Basically, I’m puilling a date (2004-02-27) from my database, and my code is producing the wrong date (2008-08-15) in the widget. Since MySQL returns strings from queries, I’m needing to convert this value over to a time structure. Here’s the snippet of code causing the offending results:
  • if (iss->date != NULL) {
      struct tm tm;
      time_t i_date;

      strptime (iss->date, “%F”, &tm);
      i_date = mktime (&tm);
      if (!(i_date == -1)) {
        gnome_date_edit_set_time (GNOME_DATE_EDIT (dateedit_issue), i_date);
      }
    }

    So, hopefully tomorrow I’ll build up some enthusiasm to figure out what’s screwin’ up.

Advertisements

3 Comments

  1. ken said

    Why don’t you store the dates in MySQL in time() format ? Then you can just convert string -> int() -> time(). If not, it is probably something to do with your use of &tm.

  2. ken said

    I’m switching over to AIM also. Y! has been too unstable and everyone else I know is also switching to AIM.

  3. Brian said

    Cool, you’ll have to forward me your AIM id.
    I’m storing the dates in MySQL in a time() format, but unfortunely the MySQL API will only return a string on queries. I’m guessing when I’m calling the strptime function, I’m not intializing the time structure correctly, and that’s why when I convert that to a time_t with the mktime() function it gets all screwed up.

RSS feed for comments on this post

Comments are closed.

%d bloggers like this: