From: Michael Vrable Date: Mon, 24 Aug 2009 22:43:08 +0000 (-0700) Subject: Fix up current time computation (ensure 64-bit math is used). X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=9bf82653d36b735f835d78112c067030de77c9c5;p=bluesky.git Fix up current time computation (ensure 64-bit math is used). --- diff --git a/inode.c b/inode.c index b9da798..4437c04 100644 --- a/inode.c +++ b/inode.c @@ -21,7 +21,7 @@ int64_t bluesky_get_current_time() { GTimeVal t; g_get_current_time(&t); - return t.tv_sec * 1000000 + t.tv_usec; + return (int64_t)t.tv_sec * 1000000 + t.tv_usec; } /* Unfortunately a glib hash table is only guaranteed to be able to store diff --git a/main.c b/main.c index 9c92356..596f7cb 100644 --- a/main.c +++ b/main.c @@ -21,6 +21,8 @@ int main(int argc, char *argv[]) printf("BlueSkyFS starting...\n"); + printf(" time = %lld\n", bluesky_get_current_time()); + BlueSkyInode *root = bluesky_new_inode(1, BLUESKY_DIRECTORY); bluesky_directory_insert(root, "foo", 2); diff --git a/nfs3/Makefile b/nfs3/Makefile index 59ee50b..1a5f040 100644 --- a/nfs3/Makefile +++ b/nfs3/Makefile @@ -1,6 +1,6 @@ PACKAGES=glib-2.0 gthread-2.0 DEBUG=-g -CFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) -I.. \ +CFLAGS=-Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) -I.. \ $(shell pkg-config --cflags $(PACKAGES)) LDFLAGS=$(DEBUG) $(shell pkg-config --libs $(PACKAGES)) diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index da8d76b..aaf23b4 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -238,6 +238,11 @@ nfsproc3_create_3_svc(create3args *argp, struct svc_req *rqstp) file = bluesky_new_inode(bluesky_fs_alloc_inode(fs), BLUESKY_REGULAR); file->nlink = 1; file->mode = 0755; + int64_t time = bluesky_get_current_time(); + printf("time: %lld\n", time); + file->mtime = time; + file->ctime = time; + file->atime = time; bluesky_insert_inode(fs, file); bluesky_directory_insert(dir, argp->where.name, file->inum);