Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1191 (closed defect: fixed)

Opened 16 years ago

Last modified 15 years ago

Path.modified(name) same as Path.created(name) if modified now

Reported by: yidabu Assigned to: larsivi
Priority: major Milestone: 0.99.8
Component: Core Functionality Version: trunk
Keywords: path Cc: schveiguy

Description (Last modified by yidabu)

assume D:\test.txt created yesterday, and modified now.

        import Path = tango.io.Path;
        auto name = "D:\\test.txt";
        auto modified = Path.modified(name);
        auto created = Path.created(name);
        Stdout.formatln("modified {}", modified.ticks); //633517142269165056
        Stdout.formatln("created {}", created.ticks);   //633517142269165056
        assert(modified.ticks == created.ticks );       //true
        assert(modified == created );                   //true

        assert(Path.modified(name) == Path.created(name)); //failure
        assert(Path.modified(name).ticks == Path.created(name).ticks); //failure
        

Driver D:\ is FAT32 format, but Path.timeStamps(name).created returns UTC time.

tested with latest tango-trunk, Windows XP

Change History

07/16/08 21:20:17 changed by schveiguy

Can you try this code out? I think this is related to a compiler bug which I just added (http://d.puremagic.com/issues/show_bug.cgi?id=2232)

import Path = tango.io.Path;
auto name = "D:\\test.txt";
assert(Path.timeStamps(name).modified == Path.timeStamps(name).created);

If this version works (meaning, the assert throws), then you are probably running into the same bug.

07/18/08 02:46:25 changed by yidabu

bug:

import Path = tango.io.Path;
auto name = "D:\\test.txt";
assert(Path.modified(name).ticks == Path.created(name).ticks);

Seems this version works, thanks.

import Path = tango.io.Path;
auto name = "D:\\test.txt";
assert(Path.timeStamps(name).modified.ticks == Path.timeStamps(name).created.ticks);

07/18/08 02:51:13 changed by schveiguy

Does the version I proposed not work unless you use the 'ticks' to compare? I'm just curious :)

07/18/08 04:33:55 changed by yidabu

  • description changed.

more details:

        auto name = "D:\\test.txt";
        auto modified = Path.modified(name);
        auto created = Path.created(name);
        Stdout.formatln("modified {}", modified.ticks); //633517142269165056
        Stdout.formatln("created {}", created.ticks);   //633517142269165056
        assert(modified.ticks == created.ticks );       //true
        assert(modified == created );                   //true

        assert(Path.modified(name) == Path.created(name)); //failure
        assert(Path.modified(name).ticks == Path.created(name).ticks); //failure

another bug, Driver D:\ is FAT32 format, but Path.timeStamps(name).created returns UTC time.

        Return timestamp information

        Timstamps are returns in a format dictated by the 
        file-system. For example NTFS keeps UTC time, 
        while FAT timestamps are based on the local time

FS.Stamps timeStamps (char[] name)
{
        char[512] tmp = void;
        return FS.timeStamps (FS.strz(name, tmp));
}

07/18/08 04:35:14 changed by yidabu

  • description changed.

07/18/08 04:35:49 changed by yidabu

  • description changed.

07/18/08 04:38:05 changed by yidabu

seems I should use phobos version in tangobos, not use tango version

07/19/08 16:24:56 changed by larsivi

  • status changed from new to assigned.
  • owner changed from sean to larsivi.
  • milestone changed from 0.99.7 to External Bugs.

The bug of the title is a compiler bug, and will be moved to the relevant "External bugs" milestone.

The UTC problem should get its own ticket.

And please do not set the milestone, it is for administration use only, use Version field to indicate the version error applies to.

07/19/08 16:27:58 changed by larsivi

See #1194 for UTC problems.

07/24/08 15:57:55 changed by schveiguy

  • cc set to schveiguy.

09/03/08 21:05:33 changed by schveiguy

Can you retest this with the latest compiler (1.034)? According to the log, the compiler bug has been fixed.

If it now works, please close as fixed.

09/18/08 22:41:05 changed by yidabu

  • status changed from assigned to closed.
  • resolution set to fixed.

tested with DMD 1.035, seems fixed now.

10/26/08 18:44:49 changed by larsivi

  • milestone changed from External Bugs to 0.99.8.