I'm not doing a very good job of explaining this!
"struc" is a Nasm macro (it is defined in standard.mac, but you shouldn't have to delve into the Nasm source code). The fact that C (and perhaps other assemblers) spell it "struct" and Nasm spells it "struc" is a source of typos! I know "struc", but (perhaps unwisely) used ""jstruct" or sometimes "jstruc" as a name for the structure type. As a name for an instance of this type, I used "thestruc". This hasn't helped!
"struc" just defines the type of structure. It does not allocate any memory, or initialize anything. Often, we don't need to. For example, a structure that defines a directory entry can be filled with data from disk, without having an "istruc". In this case, we want an initialized instance of the structure. From "struc", Nasm defines the offsets to the members, and the size of the whole structure as "name_size". It uses the "times" mechanism to do this, which is why "times" often appears in the error message. (if it helps you, Masm uses "dup" instead of "times")
Perhaps it would be wise to use the same name for the type of structure that nanosleep expects as C uses: "timespec". I'll use the same names for the elements, too.
struc timespec
tv_sec resd 1
tv_nsec resd 1
endstruc
In this case I have not used Nasm's "local label" mechanism of starting the label with a dot. This means that you won't be able to use the names "tv_sec" and "tv_nsec" elsewhere in your program, but may simplify things otherwise. Nasm now knows that "tv_sec" is zero, "tv_nsec" is 4, and "timespec_size" is 8. Note that the member names are offsets from the start of the structure, not the complete address. We need to do this before creating an instance of this type.
Now we want an instance of this type of structure specifying 5 seconds (or whatever delay you want). Nasm uses the "istruc" macro for this. Suppose we call it "mytime".
mytime istruc timespec
at tv_sec, dd 5
at tv_nsec, dd 0
iend
We don't have to initialize all of the members. Nasm will initialize any we skip to zero (again using "times"). They do need to be "in order".
Actually, nanosleep expects two of these structures, or the second parameter can be NULL. I use the same structure for both "time requested" and "time remaining". I'm not sure this is correct, but it "seems to work". I would know if it didn't work only if nanosleep got interrupted, which probably doesn't happen very often (?).
This covers only the "delay", not actually deleting anything...
Best,
Frank