diff options
| author | tomas <tomas> | 2004-10-27 18:01:01 +0000 |
|---|---|---|
| committer | tomas <tomas> | 2004-10-27 18:01:01 +0000 |
| commit | 0cc45c2881289e017fc9bf0402033b59e6c2fd77 (patch) | |
| tree | 13ccccb3d718d734d738c936b9d9271e71eb29a2 | |
| parent | 436e50c96a2b89bba9a75e90f3fa036c03546970 (diff) | |
| download | luafilesystem-0cc45c2881289e017fc9bf0402033b59e6c2fd77.tar.gz luafilesystem-0cc45c2881289e017fc9bf0402033b59e6c2fd77.tar.bz2 luafilesystem-0cc45c2881289e017fc9bf0402033b59e6c2fd77.zip | |
Correcao nos campos de alteracao, modificacao e acesso do arquivo.
| -rw-r--r-- | src/lfs.c | 16 |
1 files changed, 4 insertions, 12 deletions
| @@ -9,7 +9,7 @@ | |||
| 9 | ** lfs.lock (fh, mode) | 9 | ** lfs.lock (fh, mode) |
| 10 | ** lfs.unlock (fh) | 10 | ** lfs.unlock (fh) |
| 11 | ** | 11 | ** |
| 12 | ** $Id: lfs.c,v 1.4 2004/10/23 22:33:11 tomas Exp $ | 12 | ** $Id: lfs.c,v 1.5 2004/10/27 18:01:01 tomas Exp $ |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <errno.h> | 15 | #include <errno.h> |
| @@ -368,14 +368,6 @@ static const char *mode2string (mode_t mode) { | |||
| 368 | 368 | ||
| 369 | 369 | ||
| 370 | /* | 370 | /* |
| 371 | ** Convert a struct timespec to a Lua table. | ||
| 372 | */ | ||
| 373 | static lua_Number time2number (struct timespec t) { | ||
| 374 | return (lua_Number)t.tv_sec + (lua_Number)t.tv_nsec / 1000000000.0; | ||
| 375 | } | ||
| 376 | |||
| 377 | |||
| 378 | /* | ||
| 379 | ** Get file information | 371 | ** Get file information |
| 380 | */ | 372 | */ |
| 381 | static int file_info (lua_State *L) { | 373 | static int file_info (lua_State *L) { |
| @@ -418,15 +410,15 @@ static int file_info (lua_State *L) { | |||
| 418 | lua_rawset (L, -3); | 410 | lua_rawset (L, -3); |
| 419 | /* time of last access */ | 411 | /* time of last access */ |
| 420 | lua_pushliteral (L, "access"); | 412 | lua_pushliteral (L, "access"); |
| 421 | lua_pushnumber (L, time2number (info.st_atimespec)); | 413 | lua_pushnumber (L, info.st_atime); |
| 422 | lua_rawset (L, -3); | 414 | lua_rawset (L, -3); |
| 423 | /* time of last data modification */ | 415 | /* time of last data modification */ |
| 424 | lua_pushliteral (L, "modification"); | 416 | lua_pushliteral (L, "modification"); |
| 425 | lua_pushnumber (L, time2number (info.st_mtimespec)); | 417 | lua_pushnumber (L, info.st_mtime); |
| 426 | lua_rawset (L, -3); | 418 | lua_rawset (L, -3); |
| 427 | /* time of last file status change */ | 419 | /* time of last file status change */ |
| 428 | lua_pushliteral (L, "change"); | 420 | lua_pushliteral (L, "change"); |
| 429 | lua_pushnumber (L, time2number (info.st_ctimespec)); | 421 | lua_pushnumber (L, info.st_ctime); |
| 430 | lua_rawset (L, -3); | 422 | lua_rawset (L, -3); |
| 431 | /* file size, in bytes */ | 423 | /* file size, in bytes */ |
| 432 | lua_pushliteral (L, "size"); | 424 | lua_pushliteral (L, "size"); |
