1)
You can directly assign to an attribute, like "joint1.rotateZ = sin ( time )*10 ;" only inside an expression - but not in script editor. In script editor, u have to use "setAttr".
2)
Use "currentTime" command in place of "frame" (or "time") in script editor.
so, ur script shud b:
int $fram = currentTime -q;
setAttr "joint1.rotateZ" (sin($fram/(float)24)*10);
//Divide by 24 to calculate time if frames/sec = 24