I'm unsure what you mean by "according to specified time", but I think you want :
SELECT * FROM j;
┌───────────────────────────────────────────────────┐
│ doc │
├───────────────────────────────────────────────────┤
│ {"eid": {"a": 5, "b": 6, "c": 9}, "time": 12345} │
│ {"eid": {"b": 6, "c": 9, "x": 25}, "time": 13255} │
└───────────────────────────────────────────────────┘
(2 rows)
SELECT SUM((doc#>>'{eid,a}')::integer)
FROM j
WHERE (doc->>'time')::integer = 12345;
┌─────┐
│ sum │
├─────┤
│ 5 │
└─────┘
(1 row)
EDIT
To get all the keys at once (you might need to change jsonb_* to json_* depending on your schema) :
SELECT key, SUM(jsonb_extract_path_text(doc, 'eid', key)::integer)
FROM j, jsonb_object_keys(doc->'eid') sub(key)
GROUP BY key
;
┌─────┬─────┐
│ key │ sum │
├─────┼─────┤
│ x │ 25 │
│ b │ 12 │
│ a │ 5 │
│ c │ 18 │
└─────┴─────┘
(4 rows)
select json_each(events.doc->'eid') from eventsthat produced records like ('a',5).