tUse number of seconds since epoch as a timestamp for naming files uniquely - ratox - FIFO based tox client
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f886546a26e5f9c676946631ec95c314a406444f
 (DIR) parent ab446bf99aed86e4e0955894f1019e35676c7fb5
 (HTM) Author: sin <sin@2f30.org>
       Date:   Mon, 22 Sep 2014 16:15:58 +0100
       
       Use number of seconds since epoch as a timestamp for naming files uniquely
       
       This breaks if time travel becomes a possibility.
       
       Diffstat:
         M ratox.c                             |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/ratox.c b/ratox.c
       t@@ -979,9 +979,10 @@ sendfriendreq(void *data)
        static void
        loop(void)
        {
       +        char tstamp[64];
                struct friend *f;
                struct request *req, *rtmp;
       -        time_t t0, t1;
       +        time_t t0, t1, now;
                int connected = 0;
                int i, n;
                int fdmax;
       t@@ -1128,8 +1129,10 @@ loop(void)
                                                case TRANSFER_NONE:
                                                        /* prepare a new transfer */
                                                        f->t.state = TRANSFER_INITIATED;
       +                                                now = time(NULL);
       +                                                snprintf(tstamp, sizeof(tstamp), "%lu", (unsigned long)now);
                                                        tox_new_file_sender(tox, f->fid,
       -                                                        0, (uint8_t *)"file", strlen("file") + 1);
       +                                                        0, (uint8_t *)tstamp, strlen(tstamp));
                                                        printout("Initiated transfer to %s\n",
                                                                 f->namestr[0] == '\0' ? "Anonymous" : f->namestr);
                                                        break;