MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / SetCloseFileTimeByName

Method SetCloseFileTimeByName

Libraries/unrar/file.cpp:636–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634
635
636void File::SetCloseFileTimeByName(const wchar *Name,RarTime *ftm,RarTime *fta)
637{
638#ifdef _UNIX
639 bool setm=ftm!=NULL && ftm->IsSet();
640 bool seta=fta!=NULL && fta->IsSet();
641 if (setm || seta)
642 {
643 char NameA[NM];
644 WideToChar(Name,NameA,ASIZE(NameA));
645
646#ifdef UNIX_TIME_NS
647 timespec times[2];
648 times[0].tv_sec=seta ? fta->GetUnix() : 0;
649 times[0].tv_nsec=seta ? long(fta->GetUnixNS()%1000000000) : UTIME_NOW;
650 times[1].tv_sec=setm ? ftm->GetUnix() : 0;
651 times[1].tv_nsec=setm ? long(ftm->GetUnixNS()%1000000000) : UTIME_NOW;
652 utimensat(AT_FDCWD,NameA,times,0);
653#else
654 utimbuf ut;
655 if (setm)
656 ut.modtime=ftm->GetUnix();
657 else
658 ut.modtime=fta->GetUnix(); // Need to set something, cannot left it 0.
659 if (seta)
660 ut.actime=fta->GetUnix();
661 else
662 ut.actime=ut.modtime; // Need to set something, cannot left it 0.
663 utime(NameA,&ut);
664#endif
665 }
666#endif
667}
668
669
670void File::GetOpenFileTime(RarTime *ft)

Callers

nothing calls this directly

Calls 4

WideToCharFunction · 0.85
GetUnixMethod · 0.80
GetUnixNSMethod · 0.80
IsSetMethod · 0.45

Tested by

no test coverage detected