You're probably the same person who asked me on discord about this..
anyway, tldr from a recent conversation;
Set duration and start decay using a script when the item 'changes'.
Add a description to the item based on os.time().
Create an onLook event so the player isn't spammed with numbers.
Create a Login event, which scans a players inventory for all of these items, and adjust the duration of the item, to match with the os.time() that has passed and/or revert the item back to it's previous itemid if the item is 'expired'.
The only caveat is that items in the players depot have their duration paused as well.
I haven't looked, but there is probably some function that will let you scan through a players depot, and you can add various 'triggers' to find and alter those items as well.
- - (login/logout/stepping on/off depot tile/onThink maybe?/ -> server startup/shutdown) Gotta be careful though, since a depot can contain basically infinite items.
----
I don't know how the source code performs the duration bit, but I'm guessing it wouldn't be too hard to create another duration type that is based on os.time instead of a standard duration.
I don't know c++ at all, so I can't accurately comment on this portion.
----
Anyways,
Cheers.