create a nested structure

hey guys
I’m trying to build an attendance management system with a fingerprint.
and now I’m faced with this problem,
how to create a nested structure for my customer.
structure tree attached in the picture.
and please tell me the most efficient way to define my variable size(byte, int, long int and …)
many thanks for any help
Abolfazl Nejatian

Here is the picture you posted to make it easy for everyone


Do you mean you want to maintain a database and a log of all entries? if so where do plan to store the data? SD card?

I don't see any nesting, just two tables.

One for the persons and one for the timed events, connected by the person-id.

I would use a single datatype (long/longlong) for the time data, year/month/week/hour/min/sec can be computed from that entity.

I think I would make this in a class or actually, multiple. That can also take care of or calculating things like weekday from the date or make sure it's synchronized.

Although you could use a Unix timestamp for the date-time but on a micro I find that to be more trouble then a blessing. It's quite some calculation to go to and from a Unix timestamp.

And because I see date-time stuff, can't you just use a existing library?

Basically 2 tables, something like this

( did not check the coherence of what I put in the tables, just an idea)

which could be stored on an SD card or elsewhere (EEPROM, …) depending on volume of expected data

given Time will need to be managed, I suppose you will have a RTC connected to the system too and the RTClib does have all the necessary functions to get a unix timestamp and convert it into something usable/readable by humans